├── .gitattributes ├── .gitignore ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── Dockerfile ├── INSTALL_LINUX ├── INSTALL_WINDOWS ├── LICENSE ├── Makefile.am ├── README.md ├── README.txt ├── RELEASE_NOTES ├── aclocal.m4 ├── algo-gate-api.c ├── algo-gate-api.h ├── algo ├── argon2d │ ├── argon2d-gate.c │ ├── argon2d-gate.h │ ├── argon2d │ │ ├── argon2.c │ │ ├── argon2.h │ │ ├── argon2d_thread.c │ │ ├── argon2d_thread.h │ │ ├── core.c │ │ ├── core.h │ │ ├── encoding.c │ │ ├── encoding.h │ │ └── opt.c │ └── blake2 │ │ ├── blake2-impl.h │ │ ├── blake2.h │ │ ├── blake2b.c │ │ ├── blamka-round-opt.h │ │ └── blamka-round-ref.h ├── blake │ ├── blake-4way.c │ ├── blake-gate.c │ ├── blake-gate.h │ ├── blake.c │ ├── blake256-hash.c │ ├── blake256-hash.h │ ├── blake2b-hash.c │ ├── blake2b-hash.h │ ├── blake2b.c │ ├── blake2s-hash.c │ ├── blake2s-hash.h │ ├── blake2s.c │ ├── blake512-hash.c │ ├── blake512-hash.h │ ├── blakecoin-4way.c │ ├── blakecoin-gate.c │ ├── blakecoin-gate.h │ ├── blakecoin.c │ ├── mod_blakecoin.c │ ├── pentablake-4way.c │ ├── pentablake-gate.c │ ├── pentablake-gate.h │ ├── pentablake.c │ ├── sph-blake2s.c │ ├── sph-blake2s.h │ ├── sph_blake.c │ ├── sph_blake.h │ ├── sph_blake2b.c │ └── sph_blake2b.h ├── bmw │ ├── bmw-hash-4way.h │ ├── bmw256-hash-4way.c │ ├── bmw256.c │ ├── bmw512-4way.c │ ├── bmw512-gate.c │ ├── bmw512-gate.h │ ├── bmw512-hash-4way.c │ ├── bmw512.c │ ├── sph_bmw.c │ └── sph_bmw.h ├── cubehash │ ├── cube-hash-2way.c │ ├── cube-hash-2way.h │ ├── cubehash_sse2.c │ ├── cubehash_sse2.h │ ├── sph_cubehash.c │ └── sph_cubehash.h ├── echo │ ├── aes_ni │ │ ├── api.h │ │ ├── hash.c │ │ └── hash_api.h │ ├── echo-hash-4way.c │ ├── echo-hash-4way.h │ ├── sph_echo.c │ └── sph_echo.h ├── fugue │ ├── fugue-aesni.c │ ├── fugue-aesni.h │ ├── sph_fugue.c │ └── sph_fugue.h ├── gost │ ├── sph_gost.c │ └── sph_gost.h ├── groestl │ ├── aes_ni │ │ ├── README │ │ ├── api.h │ │ ├── architectures │ │ ├── brg_endian.h │ │ ├── groestl-intr-aes.h │ │ ├── groestl256-intr-aes.h │ │ ├── hash-groestl.c │ │ ├── hash-groestl.h │ │ ├── hash-groestl256.c │ │ ├── hash-groestl256.h │ │ └── implementors │ ├── groestl-4way.c │ ├── groestl-gate.c │ ├── groestl-gate.h │ ├── groestl.c │ ├── groestl256-hash-4way.c │ ├── groestl256-hash-4way.h │ ├── groestl256-intr-4way.h │ ├── groestl512-hash-4way.c │ ├── groestl512-hash-4way.h │ ├── groestl512-intr-4way.h │ ├── myr-groestl.c │ ├── myrgr-4way.c │ ├── myrgr-gate.c │ ├── myrgr-gate.h │ ├── sph_groestl.c │ └── sph_groestl.h ├── hamsi │ ├── hamsi-hash-4way.c │ ├── hamsi-hash-4way.h │ ├── sph_hamsi.c │ ├── sph_hamsi.h │ └── sph_hamsi_helper.c ├── haval │ ├── haval-16way-helper.c │ ├── haval-4way-helper.c │ ├── haval-8way-helper.c │ ├── haval-hash-4way.c │ ├── haval-hash-4way.h │ ├── haval-helper.c │ ├── haval.c │ └── sph-haval.h ├── jh │ ├── jh-hash-4way.c │ ├── jh-hash-4way.h │ ├── jha-4way.c │ ├── jha-gate.c │ ├── jha-gate.h │ ├── jha.c │ ├── sph_jh.c │ └── sph_jh.h ├── keccak │ ├── keccak-4way.c │ ├── keccak-gate.c │ ├── keccak-gate.h │ ├── keccak-hash-4way.c │ ├── keccak-hash-4way.h │ ├── keccak-macros.c │ ├── keccak.c │ ├── sha3d-4way.c │ ├── sha3d.c │ ├── sph_keccak.c │ └── sph_keccak.h ├── lanehash │ ├── lane.c │ └── lane.h ├── luffa │ ├── luffa-hash-2way.c │ ├── luffa-hash-2way.h │ ├── luffa_for_sse2.c │ ├── luffa_for_sse2.h │ ├── sph_luffa.c │ └── sph_luffa.h ├── lyra2 │ ├── allium-4way.c │ ├── lyra2-gate.c │ ├── lyra2-gate.h │ ├── lyra2-hash-2way.c │ ├── lyra2.c │ ├── lyra2.h │ ├── lyra2h-4way.c │ ├── lyra2h.c │ ├── lyra2re.c │ ├── lyra2rev2-4way.c │ ├── lyra2rev2.c │ ├── lyra2rev3-4way.c │ ├── lyra2rev3.c │ ├── lyra2z-4way.c │ ├── lyra2z330.c │ ├── phi2-4way.c │ ├── phi2.c │ ├── sponge-2way.c │ ├── sponge.c │ └── sponge.h ├── m7m │ └── m7m.c ├── nist5 │ ├── nist5-4way.c │ ├── nist5-gate.c │ ├── nist5-gate.h │ ├── nist5.c │ └── zr5.c ├── panama │ ├── panama-hash-4way.c │ ├── panama-hash-4way.h │ ├── sph_panama.c │ └── sph_panama.h ├── quark │ ├── anime-4way.c │ ├── anime-gate.c │ ├── anime-gate.h │ ├── anime.c │ ├── hmq1725-4way.c │ ├── hmq1725-gate.c │ ├── hmq1725-gate.h │ ├── hmq1725.c │ ├── quark-4way.c │ ├── quark-gate.c │ ├── quark-gate.h │ └── quark.c ├── qubit │ ├── deep-2way.c │ ├── deep-gate.c │ ├── deep-gate.h │ ├── deep.c │ ├── qubit-2way.c │ ├── qubit-gate.c │ ├── qubit-gate.h │ └── qubit.c ├── ripemd │ ├── lbry-4way.c │ ├── lbry-gate.c │ ├── lbry-gate.h │ ├── lbry.c │ ├── ripemd-hash-4way.c │ ├── ripemd-hash-4way.h │ ├── sph_ripemd.c │ └── sph_ripemd.h ├── scrypt │ ├── neoscrypt.c │ ├── scrypt-core-4way.c │ ├── scrypt-core-4way.h │ ├── scrypt-core-ref.c │ └── scrypt.c ├── sha │ ├── hmac-sha256-hash-4way.c │ ├── hmac-sha256-hash-4way.h │ ├── hmac-sha256-hash.c │ ├── hmac-sha256-hash.h │ ├── md_helper.c │ ├── sha1-hash.c │ ├── sha1-hash.h │ ├── sha1.c │ ├── sha256-hash-4way.c │ ├── sha256-hash.c │ ├── sha256-hash.h │ ├── sha256d-4way.c │ ├── sha256d-4way.h │ ├── sha256d.c │ ├── sha256d.h │ ├── sha256dt.c │ ├── sha256q-4way.c │ ├── sha256q.c │ ├── sha256t-4way.c │ ├── sha256t-gate.c │ ├── sha256t-gate.h │ ├── sha512-hash-4way.c │ ├── sha512-hash.h │ ├── sha512256d-4way.c │ ├── sph_sha1.h │ ├── sph_sha2.c │ ├── sph_sha2.h │ └── sph_sha2big.c ├── shabal │ ├── shabal-hash-4way.c │ ├── shabal-hash-4way.h │ ├── sph_shabal.c │ └── sph_shabal.h ├── shavite │ ├── shavite-hash-2way.c │ ├── shavite-hash-2way.h │ ├── shavite-hash-4way.c │ ├── shavite-hash-4way.h │ ├── shavite-hash.h │ ├── shavite.c │ ├── sph-shavite-aesni.c │ ├── sph_shavite.c │ └── sph_shavite.h ├── simd │ ├── simd-hash-2way.c │ ├── simd-hash-2way.h │ ├── simd_iv.h │ ├── sph_simd.c │ └── sph_simd.h ├── skein │ ├── skein-4way.c │ ├── skein-gate.c │ ├── skein-gate.h │ ├── skein-hash-4way.c │ ├── skein-hash-4way.h │ ├── skein.c │ ├── skein2-4way.c │ ├── skein2.c │ ├── sph_skein.c │ └── sph_skein.h ├── sm3 │ ├── sm3-hash-4way.c │ ├── sm3-hash-4way.h │ ├── sm3.c │ └── sph_sm3.h ├── swifftx │ ├── inttypes.h │ ├── stdint.h │ ├── swifftx.c │ └── swifftx.h ├── tiger │ ├── sph_tiger.c │ └── sph_tiger.h ├── verthash │ ├── Verthash.c │ ├── Verthash.h │ ├── fopen_utf8.c │ ├── fopen_utf8.h │ ├── tiny_sha3 │ │ ├── sha3-4way.c │ │ ├── sha3-4way.h │ │ ├── sha3.c │ │ └── sha3.h │ └── verthash-gate.c ├── whirlpool │ ├── md_helper.c │ ├── sph_whirlpool.c │ ├── sph_whirlpool.h │ ├── whirlpool-gate.c │ ├── whirlpool-gate.h │ ├── whirlpool.c │ └── whirlpoolx.c ├── x11 │ ├── c11-4way.c │ ├── c11-gate.c │ ├── c11-gate.h │ ├── c11.c │ ├── timetravel-4way.c │ ├── timetravel-gate.c │ ├── timetravel-gate.h │ ├── timetravel.c │ ├── timetravel10-4way.c │ ├── timetravel10-gate.c │ ├── timetravel10-gate.h │ ├── timetravel10.c │ ├── tribus-4way.c │ ├── tribus-gate.c │ ├── tribus-gate.h │ ├── tribus.c │ ├── x11-4way.c │ ├── x11-gate.c │ ├── x11-gate.h │ ├── x11.c │ ├── x11evo-4way.c │ ├── x11evo-gate.c │ ├── x11evo-gate.h │ ├── x11evo.c │ ├── x11gost-4way.c │ ├── x11gost-gate.c │ ├── x11gost-gate.h │ └── x11gost.c ├── x12 │ ├── x12-4way.c │ ├── x12-gate.c │ ├── x12-gate.h │ └── x12.c ├── x13 │ ├── phi1612-4way.c │ ├── phi1612-gate.c │ ├── phi1612-gate.h │ ├── phi1612.c │ ├── skunk-4way.c │ ├── skunk-gate.c │ ├── skunk-gate.h │ ├── skunk.c │ ├── x13-4way.c │ ├── x13-gate.c │ ├── x13-gate.h │ ├── x13.c │ ├── x13bcd-4way.c │ ├── x13bcd.c │ ├── x13sm3-4way.c │ ├── x13sm3-gate.c │ ├── x13sm3-gate.h │ └── x13sm3.c ├── x14 │ ├── axiom.c │ ├── polytimos-4way.c │ ├── polytimos-gate.c │ ├── polytimos-gate.h │ ├── polytimos.c │ ├── veltor-4way.c │ ├── veltor-gate.c │ ├── veltor-gate.h │ ├── veltor.c │ ├── x14-4way.c │ ├── x14-gate.c │ ├── x14-gate.h │ └── x14.c ├── x15 │ ├── x15-4way.c │ ├── x15-gate.c │ ├── x15-gate.h │ └── x15.c ├── x16 │ ├── hex.c │ ├── minotaur.c │ ├── x16r-4way.c │ ├── x16r-gate.c │ ├── x16r-gate.h │ ├── x16r.c │ ├── x16rt-4way.c │ ├── x16rt.c │ ├── x16rv2-4way.c │ ├── x16rv2.c │ ├── x20r.c │ ├── x21s-4way.c │ └── x21s.c ├── x17 │ ├── sonoa-4way.c │ ├── sonoa-gate.c │ ├── sonoa-gate.h │ ├── sonoa.c │ ├── x17-4way.c │ ├── x17-gate.c │ ├── x17-gate.h │ ├── x17.c │ ├── xevan-4way.c │ ├── xevan-gate.c │ ├── xevan-gate.h │ └── xevan.c ├── x22 │ ├── x22i-4way.c │ ├── x22i-gate.c │ ├── x22i-gate.h │ ├── x22i.c │ ├── x25x-4way.c │ └── x25x.c └── yespower │ ├── PERFORMANCE │ ├── README │ ├── TESTS-OK │ ├── benchmark.c │ ├── crypto │ ├── hmac-blake2b.c │ └── hmac-blake2b.h │ ├── tests.c │ ├── yescrypt-r8g.c │ ├── yescrypt-r8g.h │ ├── yespower-4way.c │ ├── yespower-blake2b-ref.c │ ├── yespower-blake2b.c │ ├── yespower-gate.c │ ├── yespower-opt.c │ ├── yespower-platform.c │ ├── yespower-ref.c │ └── yespower.h ├── api.c ├── api ├── index.php ├── local-sample.php └── websocket.htm ├── armbuild-all.sh ├── asm └── neoscrypt_asm.S ├── autogen.sh ├── bitcoin-config.h ├── build-allarch.sh ├── build-armv8.sh ├── build-avx2.sh ├── build.sh ├── clean-all.sh ├── compat.h ├── compat ├── Makefile.am ├── aes_helper.c ├── brg_types.h ├── getopt │ ├── getopt.h │ └── getopt_long.c ├── gettimeofday.c ├── inttypes.h ├── jansson │ ├── .gitignore │ ├── LICENSE │ ├── Makefile.am │ ├── config.h │ ├── configure.ac │ ├── 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 ├── portable_endian.h ├── pthreads │ ├── pthread.h │ ├── sched.h │ ├── x64 │ │ ├── libpthreadGC2.a │ │ └── pthreadVC2.lib │ └── x86 │ │ └── pthreadVC2.lib ├── sha3-defs.h ├── sha3_common.h ├── sph_types.h ├── stdbool.h ├── sys │ └── time.h ├── unistd.h ├── winansi.c └── winansi.h ├── config-template.json ├── configure ├── configure.ac ├── configure~ ├── cpu-miner.c ├── cpuminer.1 ├── dummy.cpp ├── elist.h ├── junk ├── Android.mk ├── cpuminer.nsi ├── cpuminer.sln ├── cpuminer.vcxproj ├── cpuminer.vcxproj.filters └── mingw64.sh ├── m4 └── .gitignore ├── malloc-huge.c ├── malloc-huge.h ├── miner.h ├── nomacro.pl ├── res ├── cpuminer.ico ├── cpuminer.rc ├── cpuminer.svg ├── icon.rc ├── resource.h └── setup.ico ├── simd-utils.h ├── simd-utils ├── intrlv.h ├── simd-128.h ├── simd-256.h ├── simd-512.h ├── simd-int.h ├── simd-neon.h └── simd-sve.h ├── sysinfos.c ├── util.c ├── verthash-help.txt └── winbuild-cross.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | minerd* 2 | cpuminer 3 | *.exe 4 | *.o 5 | *.d 6 | gmon.out 7 | 8 | autom4te.cache 9 | .deps 10 | 11 | Makefile 12 | Makefile.in 13 | INSTALL 14 | configure.lineno 15 | depcomp 16 | missing 17 | install-sh 18 | stamp-h1 19 | cpuminer-config.h* 20 | compile 21 | config.log 22 | config.status 23 | config.status.lineno 24 | config.guess 25 | config.sub 26 | 27 | mingw32-config.cache 28 | 29 | */.dirstamp 30 | */*/.dirstamp 31 | */*/*/.dirstamp 32 | *.iml 33 | 34 | *.vcxproj.user 35 | *.opensdf 36 | *.sdf 37 | *.suo 38 | Release/ 39 | Debug/ 40 | x64/Release/ 41 | x64/Debug/ 42 | *.pdb/ 43 | 44 | installer/ 45 | res/cpuminer.aps 46 | res/RC* 47 | sign/ 48 | sign.sh 49 | 50 | compat/curl-for-windows/ 51 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c 2 | 3 | compiler: 4 | - gcc 5 | 6 | before_install: 7 | - sudo apt-get update -qq 8 | - sudo apt-get install libcurl4-openssl-dev 9 | 10 | before_script: 11 | - ./autogen.sh 12 | 13 | script: 14 | - ./configure --with-crypto --with-curl 15 | - make 16 | - ./cpuminer --cputest 17 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Jeff Garzik 2 | 3 | ArtForz 4 | 5 | pooler 6 | 7 | BlueDragon747 8 | 9 | 1gh 10 | 11 | Neisklar 12 | 13 | prettyhatemachine 14 | 15 | LucasJones 16 | 17 | tpruvot@github 18 | 19 | elmad 20 | 21 | djm34 22 | 23 | palmd 24 | 25 | ig0tik3d 26 | 27 | Wolf0 28 | 29 | Optiminer 30 | 31 | Jay D Dee 32 | 33 | xcouiz@gmail.com 34 | 35 | Cryply 36 | 37 | Colin Percival 38 | Alexander Peslyak 39 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | See git repository ('git log') for full changelog. 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # Dockerfile for cpuminer-opt 3 | # usage: docker build -t cpuminer-opt:latest . 4 | # run: docker run -it --rm cpuminer-opt:latest [ARGS] 5 | # ex: docker run -it --rm cpuminer-opt:latest -a cryptonight -o cryptonight.eu.nicehash.com:3355 -u 1MiningDW2GKzf4VQfmp4q2XoUvR6iy6PD.worker1 -p x -t 3 6 | # 7 | 8 | # Build 9 | FROM ubuntu:16.04 as builder 10 | 11 | RUN apt-get update \ 12 | && apt-get install -y \ 13 | build-essential \ 14 | libssl-dev \ 15 | libgmp-dev \ 16 | libcurl4-openssl-dev \ 17 | libjansson-dev \ 18 | automake \ 19 | && rm -rf /var/lib/apt/lists/* 20 | 21 | COPY . /app/ 22 | RUN cd /app/ && ./build.sh 23 | 24 | # App 25 | FROM ubuntu:16.04 26 | 27 | RUN apt-get update \ 28 | && apt-get install -y \ 29 | libcurl3 \ 30 | libjansson4 \ 31 | && rm -rf /var/lib/apt/lists/* 32 | 33 | COPY --from=builder /app/cpuminer . 34 | ENTRYPOINT ["./cpuminer"] 35 | CMD ["-h"] 36 | -------------------------------------------------------------------------------- /INSTALL_WINDOWS: -------------------------------------------------------------------------------- 1 | Please consult the wiki for Windows compile instructions. 2 | 3 | https://github.com/JayDDee/cpuminer-opt/wiki/Compiling-from-source 4 | 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | cpuminer is available under the terms of the GNU Public License version 2. 2 | 3 | See COPYING for details. 4 | -------------------------------------------------------------------------------- /algo/argon2d/argon2d-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef ARGON2D_GATE_H__ 2 | #define ARGON2D_GATE_H__ 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | // Credits: version = 0x10, m_cost = 250. 8 | bool register_argon2d250_algo( algo_gate_t* gate ); 9 | 10 | void argon2d250_hash( void *state, const void *input ); 11 | 12 | int scanhash_argon2d250( struct work *work, uint32_t max_nonce, 13 | uint64_t *hashes_done, struct thr_info *mythr ); 14 | 15 | // Dynamic: version = 0x10, m_cost = 500. 16 | bool register_argon2d500_algo( algo_gate_t* gate ); 17 | 18 | void argon2d500_hash( void *state, const void *input ); 19 | 20 | int scanhash_argon2d500( struct work *work, uint32_t max_nonce, 21 | uint64_t *hashes_done, struct thr_info *mythr ); 22 | 23 | 24 | // Unitus: version = 0x13, m_cost = 4096. 25 | bool register_argon2d4096_algo( algo_gate_t* gate ); 26 | 27 | int scanhash_argon2d4096( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /algo/argon2d/argon2d/argon2d_thread.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Argon2 reference source code package - reference C implementations 3 | * 4 | * Copyright 2015 5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves 6 | * 7 | * You may use this work under the terms of a Creative Commons CC0 1.0 8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of 9 | * these licenses can be found at: 10 | * 11 | * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 12 | * - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * You should have received a copy of both of these licenses along with this 15 | * software. If not, they may be obtained at the above URLs. 16 | */ 17 | 18 | #if !defined(ARGON2_NO_THREADS) 19 | 20 | #include "argon2d_thread.h" 21 | #if defined(_WIN32) 22 | #include 23 | #endif 24 | 25 | int argon2_thread_create(argon2_thread_handle_t *handle, 26 | argon2_thread_func_t func, void *args) { 27 | if (NULL == handle || func == NULL) { 28 | return -1; 29 | } 30 | #if defined(_WIN32) 31 | *handle = _beginthreadex(NULL, 0, func, args, 0, NULL); 32 | return *handle != 0 ? 0 : -1; 33 | #else 34 | return pthread_create(handle, NULL, func, args); 35 | #endif 36 | } 37 | 38 | int argon2_thread_join(argon2_thread_handle_t handle) { 39 | #if defined(_WIN32) 40 | if (WaitForSingleObject((HANDLE)handle, INFINITE) == WAIT_OBJECT_0) { 41 | return CloseHandle((HANDLE)handle) != 0 ? 0 : -1; 42 | } 43 | return -1; 44 | #else 45 | return pthread_join(handle, NULL); 46 | #endif 47 | } 48 | 49 | void argon2_thread_exit(void) { 50 | #if defined(_WIN32) 51 | _endthreadex(0); 52 | #else 53 | pthread_exit(NULL); 54 | #endif 55 | } 56 | 57 | #endif /* ARGON2_NO_THREADS */ 58 | -------------------------------------------------------------------------------- /algo/argon2d/argon2d/argon2d_thread.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Argon2 reference source code package - reference C implementations 3 | * 4 | * Copyright 2015 5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves 6 | * 7 | * You may use this work under the terms of a Creative Commons CC0 1.0 8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of 9 | * these licenses can be found at: 10 | * 11 | * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 12 | * - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * You should have received a copy of both of these licenses along with this 15 | * software. If not, they may be obtained at the above URLs. 16 | */ 17 | 18 | #ifndef ARGON2_THREAD_H 19 | #define ARGON2_THREAD_H 20 | 21 | #if !defined(ARGON2_NO_THREADS) 22 | 23 | /* 24 | Here we implement an abstraction layer for the simpĺe requirements 25 | of the Argon2 code. We only require 3 primitives---thread creation, 26 | joining, and termination---so full emulation of the pthreads API 27 | is unwarranted. Currently we wrap pthreads and Win32 threads. 28 | 29 | The API defines 2 types: the function pointer type, 30 | argon2_thread_func_t, 31 | and the type of the thread handle---argon2_thread_handle_t. 32 | */ 33 | #if defined(_WIN32) 34 | #include 35 | typedef unsigned(__stdcall *argon2_thread_func_t)(void *); 36 | typedef uintptr_t argon2_thread_handle_t; 37 | #else 38 | #include 39 | typedef void *(*argon2_thread_func_t)(void *); 40 | typedef pthread_t argon2_thread_handle_t; 41 | #endif 42 | 43 | /* Creates a thread 44 | * @param handle pointer to a thread handle, which is the output of this 45 | * function. Must not be NULL. 46 | * @param func A function pointer for the thread's entry point. Must not be 47 | * NULL. 48 | * @param args Pointer that is passed as an argument to @func. May be NULL. 49 | * @return 0 if @handle and @func are valid pointers and a thread is successfully 50 | * created. 51 | */ 52 | int argon2_thread_create(argon2_thread_handle_t *handle, 53 | argon2_thread_func_t func, void *args); 54 | 55 | /* Waits for a thread to terminate 56 | * @param handle Handle to a thread created with argon2_thread_create. 57 | * @return 0 if @handle is a valid handle, and joining completed successfully. 58 | */ 59 | int argon2_thread_join(argon2_thread_handle_t handle); 60 | 61 | /* Terminate the current thread. Must be run inside a thread created by 62 | * argon2_thread_create. 63 | */ 64 | void argon2_thread_exit(void); 65 | 66 | #endif /* ARGON2_NO_THREADS */ 67 | #endif 68 | -------------------------------------------------------------------------------- /algo/argon2d/argon2d/encoding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Argon2 reference source code package - reference C implementations 3 | * 4 | * Copyright 2015 5 | * Daniel Dinu, Dmitry Khovratovich, Jean-Philippe Aumasson, and Samuel Neves 6 | * 7 | * You may use this work under the terms of a Creative Commons CC0 1.0 8 | * License/Waiver or the Apache Public License 2.0, at your option. The terms of 9 | * these licenses can be found at: 10 | * 11 | * - CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0 12 | * - Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * You should have received a copy of both of these licenses along with this 15 | * software. If not, they may be obtained at the above URLs. 16 | */ 17 | 18 | #ifndef ENCODING_H 19 | #define ENCODING_H 20 | #include "argon2.h" 21 | 22 | #define ARGON2_MAX_DECODED_LANES UINT32_C(255) 23 | #define ARGON2_MIN_DECODED_SALT_LEN UINT32_C(8) 24 | #define ARGON2_MIN_DECODED_OUT_LEN UINT32_C(12) 25 | 26 | /* 27 | * encode an Argon2 hash string into the provided buffer. 'dst_len' 28 | * contains the size, in characters, of the 'dst' buffer; if 'dst_len' 29 | * is less than the number of required characters (including the 30 | * terminating 0), then this function returns ARGON2_ENCODING_ERROR. 31 | * 32 | * on success, ARGON2_OK is returned. 33 | */ 34 | int encode_string(char *dst, size_t dst_len, argon2_context *ctx, 35 | argon2_type type); 36 | 37 | /* 38 | * Decodes an Argon2 hash string into the provided structure 'ctx'. 39 | * The only fields that must be set prior to this call are ctx.saltlen and 40 | * ctx.outlen (which must be the maximal salt and out length values that are 41 | * allowed), ctx.salt and ctx.out (which must be buffers of the specified 42 | * length), and ctx.pwd and ctx.pwdlen which must hold a valid password. 43 | * 44 | * Invalid input string causes an error. On success, the ctx is valid and all 45 | * fields have been initialized. 46 | * 47 | * Returned value is ARGON2_OK on success, other ARGON2_ codes on error. 48 | */ 49 | int decode_string(argon2_context *ctx, const char *str, argon2_type type); 50 | 51 | /* Returns the length of the encoded byte stream with length len */ 52 | size_t b64len(uint32_t len); 53 | 54 | /* Returns the length of the encoded number num */ 55 | size_t numlen(uint32_t num); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /algo/blake/blake-gate.c: -------------------------------------------------------------------------------- 1 | #include "blake-gate.h" 2 | 3 | bool register_blake_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = AVX2_OPT; 6 | #if defined(BLAKE_4WAY) 7 | four_way_not_tested(); 8 | gate->scanhash = (void*)&scanhash_blake_4way; 9 | gate->hash = (void*)&blakehash_4way; 10 | #else 11 | gate->scanhash = (void*)&scanhash_blake; 12 | gate->hash = (void*)&blakehash; 13 | #endif 14 | return true; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /algo/blake/blake-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef __BLAKE_GATE_H__ 2 | #define __BLAKE_GATE_H__ 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) 8 | #define BLAKE_4WAY 9 | #endif 10 | 11 | #if defined (BLAKE_4WAY) 12 | void blakehash_4way(void *state, const void *input); 13 | int scanhash_blake_4way( struct work *work, uint32_t max_nonce, 14 | uint64_t *hashes_done, struct thr_info *mythr ); 15 | #endif 16 | 17 | void blakehash( void *state, const void *input ); 18 | int scanhash_blake( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /algo/blake/blake.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | #include "sph_blake.h" 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | /* Move init out of loop, so init once externally, 9 | * and then use one single memcpy */ 10 | static __thread sph_blake256_context blake_mid; 11 | static __thread bool ctx_midstate_done = false; 12 | 13 | static void init_blake_hash(void) 14 | { 15 | sph_blake256_init(&blake_mid); 16 | ctx_midstate_done = true; 17 | } 18 | 19 | void blakehash(void *state, const void *input) 20 | { 21 | sph_blake256_context ctx; 22 | 23 | uint8_t hash[64] __attribute__ ((aligned (32))); 24 | uint8_t *ending = (uint8_t*) input; 25 | ending += 64; 26 | 27 | // do one memcopy to get a fresh context 28 | if (!ctx_midstate_done) { 29 | init_blake_hash(); 30 | sph_blake256(&blake_mid, input, 64); 31 | } 32 | 33 | memcpy(&ctx, &blake_mid, sizeof(blake_mid)); 34 | 35 | sph_blake256(&ctx, ending, 16); 36 | sph_blake256_close(&ctx, hash); 37 | 38 | memcpy(state, hash, 32); 39 | 40 | } 41 | 42 | int scanhash_blake( struct work *work, uint32_t max_nonce, 43 | uint64_t *hashes_done, struct thr_info *mythr ) 44 | { 45 | uint32_t *pdata = work->data; 46 | uint32_t *ptarget = work->target; 47 | const uint32_t first_nonce = pdata[19]; 48 | uint32_t HTarget = ptarget[7]; 49 | uint32_t _ALIGN(32) hash64[8]; 50 | uint32_t _ALIGN(32) endiandata[20]; 51 | uint32_t n = first_nonce; 52 | int thr_id = mythr->id; // thr_id arg is deprecated 53 | 54 | ctx_midstate_done = false; 55 | 56 | if (opt_benchmark) 57 | HTarget = 0x7f; 58 | 59 | // we need big endian data... 60 | swab32_array( endiandata, pdata, 20 ); 61 | 62 | #ifdef DEBUG_ALGO 63 | applog(LOG_DEBUG,"[%d] Target=%08x %08x", thr_id, ptarget[6], ptarget[7]); 64 | #endif 65 | 66 | do { 67 | be32enc(&endiandata[19], n); 68 | blakehash(hash64, endiandata); 69 | #ifndef DEBUG_ALGO 70 | if (hash64[7] <= HTarget && fulltest(hash64, ptarget)) { 71 | *hashes_done = n - first_nonce + 1; 72 | return true; 73 | } 74 | #else 75 | if (!(n % 0x1000) && !thr_id) printf("."); 76 | if (hash64[7] == 0) { 77 | printf("[%d]",thr_id); 78 | if (fulltest(hash64, ptarget)) { 79 | *hashes_done = n - first_nonce + 1; 80 | return true; 81 | } 82 | } 83 | #endif 84 | n++; pdata[19] = n; 85 | 86 | } while (n < max_nonce && !work_restart[thr_id].restart); 87 | 88 | *hashes_done = n - first_nonce + 1; 89 | pdata[19] = n; 90 | return 0; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /algo/blake/blake2b-hash.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef BLAKE2B_HASH_4WAY_H__ 3 | #define BLAKE2B_HASH_4WAY_H__ 4 | 5 | #include "simd-utils.h" 6 | #include 7 | #include 8 | 9 | #if defined(_MSC_VER) 10 | #include 11 | #define inline __inline 12 | #define ALIGN(x) __declspec(align(x)) 13 | #else 14 | #define ALIGN(x) __attribute__((aligned(x))) 15 | #endif 16 | 17 | 18 | #if defined(SIMD512) 19 | 20 | typedef struct ALIGN( 64 ) { 21 | __m512i b[16]; // input buffer 22 | __m512i h[8]; // chained state 23 | uint64_t t[2]; // total number of bytes 24 | size_t c; // pointer for b[] 25 | size_t outlen; // digest size 26 | } blake2b_8x64_ctx; 27 | 28 | int blake2b_8x64_init( blake2b_8x64_ctx *ctx ); 29 | void blake2b_8x64_update( blake2b_8x64_ctx *ctx, const void *input, 30 | size_t inlen ); 31 | void blake2b_8x64_final( blake2b_8x64_ctx *ctx, void *out ); 32 | 33 | #define blake2b_8way_ctx blake2b_8x64_ctx 34 | #define blake2b_8way_init blake2b_8x64_init 35 | #define blake2b_8way_update blake2b_8x64_update 36 | #define blake2b_8way_final blake2b_8x64_final 37 | 38 | #endif 39 | 40 | #if defined(__AVX2__) 41 | 42 | // state context 43 | typedef struct ALIGN( 64 ) { 44 | __m256i b[16]; // input buffer 45 | __m256i h[8]; // chained state 46 | uint64_t t[2]; // total number of bytes 47 | size_t c; // pointer for b[] 48 | size_t outlen; // digest size 49 | } blake2b_4x64_ctx; 50 | 51 | int blake2b_4x64_init( blake2b_4x64_ctx *ctx ); 52 | void blake2b_4x64_update( blake2b_4x64_ctx *ctx, const void *input, 53 | size_t inlen ); 54 | void blake2b_4x64_final( blake2b_4x64_ctx *ctx, void *out ); 55 | 56 | #define blake2b_4way_ctx blake2b_4x64_ctx 57 | #define blake2b_4way_init blake2b_4x64_init 58 | #define blake2b_4way_update blake2b_4x64_update 59 | #define blake2b_4way_final blake2b_4x64_final 60 | 61 | #endif 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /algo/blake/blakecoin-gate.c: -------------------------------------------------------------------------------- 1 | #include "blakecoin-gate.h" 2 | #include 3 | 4 | // vanilla uses default gen merkle root, otherwise identical to blakecoin 5 | bool register_vanilla_algo( algo_gate_t* gate ) 6 | { 7 | #if defined(BLAKECOIN_16WAY) 8 | gate->scanhash = (void*)&scanhash_blakecoin_16way; 9 | #elif defined(BLAKECOIN_8WAY) 10 | gate->scanhash = (void*)&scanhash_blakecoin_8way; 11 | #elif defined(BLAKECOIN_4WAY) 12 | gate->scanhash = (void*)&scanhash_blakecoin_4way; 13 | gate->hash = (void*)&blakecoin_4way_hash; 14 | #else 15 | gate->scanhash = (void*)&scanhash_blakecoin; 16 | gate->hash = (void*)&blakecoinhash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; 19 | return true; 20 | } 21 | 22 | bool register_blakecoin_algo( algo_gate_t* gate ) 23 | { 24 | register_vanilla_algo( gate ); 25 | gate->gen_merkle_root = (void*)&sha256_gen_merkle_root; 26 | return true; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /algo/blake/blakecoin-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef BLAKECOIN_GATE_H__ 2 | #define BLAKECOIN_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define BLAKECOIN_16WAY 9 | #elif defined(__AVX2__) 10 | #define BLAKECOIN_8WAY 11 | #elif defined(__SSE2__) // always true 12 | #define BLAKECOIN_4WAY 13 | #endif 14 | 15 | #if defined (BLAKECOIN_16WAY) 16 | int scanhash_blakecoin_16way( struct work *work, uint32_t max_nonce, 17 | uint64_t *hashes_done, struct thr_info *mythr ); 18 | 19 | #elif defined (BLAKECOIN_8WAY) 20 | //void blakecoin_8way_hash(void *state, const void *input); 21 | int scanhash_blakecoin_8way( struct work *work, uint32_t max_nonce, 22 | uint64_t *hashes_done, struct thr_info *mythr ); 23 | 24 | #elif defined (BLAKECOIN_4WAY) 25 | void blakecoin_4way_hash(void *state, const void *input); 26 | int scanhash_blakecoin_4way( struct work *work, uint32_t max_nonce, 27 | uint64_t *hashes_done, struct thr_info *mythr ); 28 | #else // never used 29 | 30 | void blakecoinhash( void *state, const void *input ); 31 | int scanhash_blakecoin( struct work *work, uint32_t max_nonce, 32 | uint64_t *hashes_done, struct thr_info *mythr ); 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /algo/blake/pentablake-gate.c: -------------------------------------------------------------------------------- 1 | #include "pentablake-gate.h" 2 | 3 | bool register_pentablake_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (PENTABLAKE_4WAY) 6 | gate->scanhash = (void*)&scanhash_pentablake_4way; 7 | gate->hash = (void*)&pentablakehash_4way; 8 | #else 9 | gate->scanhash = (void*)&scanhash_pentablake; 10 | gate->hash = (void*)&pentablakehash; 11 | #endif 12 | gate->optimizations = AVX2_OPT; 13 | return true; 14 | }; 15 | 16 | -------------------------------------------------------------------------------- /algo/blake/pentablake-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef __PENTABLAKE_GATE_H__ 2 | #define __PENTABLAKE_GATE_H__ 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | // 4way is broken 8 | //#if defined(__AVX2__) 9 | // #define PENTABLAKE_4WAY 10 | //#endif 11 | 12 | #if defined(PENTABLAKE_4WAY) 13 | void pentablakehash_4way( void *state, const void *input ); 14 | int scanhash_pentablake_4way( struct work *work, 15 | uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ); 16 | #endif 17 | 18 | void pentablakehash( void *state, const void *input ); 19 | int scanhash_pentablake( struct work *work, uint32_t max_nonce, 20 | uint64_t *hashes_done, struct thr_info *mythr ); 21 | #endif 22 | 23 | -------------------------------------------------------------------------------- /algo/blake/sph_blake2b.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef __BLAKE2B_H__ 3 | #define __BLAKE2B_H__ 4 | 5 | #include 6 | #include 7 | 8 | #if defined(_MSC_VER) 9 | #include 10 | #define inline __inline 11 | #define ALIGN(x) __declspec(align(x)) 12 | #else 13 | #define ALIGN(x) __attribute__((aligned(x))) 14 | #endif 15 | 16 | #if defined(_MSC_VER) || defined(__x86_64__) || defined(__x86__) 17 | #define NATIVE_LITTLE_ENDIAN 18 | #endif 19 | 20 | // state context 21 | typedef ALIGN(64) struct { 22 | uint8_t b[128]; // input buffer 23 | uint64_t h[8]; // chained state 24 | uint64_t t[2]; // total number of bytes 25 | size_t c; // pointer for b[] 26 | size_t outlen; // digest size 27 | } sph_blake2b_ctx; 28 | 29 | #if defined(__cplusplus) 30 | extern "C" { 31 | #endif 32 | 33 | int sph_blake2b_init( sph_blake2b_ctx *ctx, size_t outlen, const void *key, size_t keylen); 34 | void sph_blake2b_update( sph_blake2b_ctx *ctx, const void *in, size_t inlen); 35 | void sph_blake2b_final( sph_blake2b_ctx *ctx, void *out); 36 | 37 | #if defined(__cplusplus) 38 | } 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /algo/bmw/bmw256.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "sph_bmw.h" 7 | 8 | void bmwhash(void *output, const void *input) 9 | { 10 | /* 11 | uint32_t hash[16]; 12 | sph_bmw256_context ctx; 13 | 14 | sph_bmw256_init(&ctx); 15 | sph_bmw256(&ctx, input, 80); 16 | sph_bmw256_close(&ctx, hash); 17 | 18 | memcpy(output, hash, 32); 19 | */ 20 | } 21 | 22 | int scanhash_bmw( struct work *work, uint32_t max_nonce, 23 | uint64_t *hashes_done, struct thr_info *mythr ) 24 | { 25 | uint32_t *pdata = work->data; 26 | uint32_t *ptarget = work->target; 27 | 28 | uint32_t _ALIGN(64) hash64[8]; 29 | uint32_t _ALIGN(64) endiandata[20]; 30 | int thr_id = mythr->id; 31 | 32 | const uint32_t Htarg = ptarget[7]; 33 | const uint32_t first_nonce = pdata[19]; 34 | 35 | uint32_t n = first_nonce; 36 | 37 | for (int k = 0; k < 19; k++) 38 | be32enc(&endiandata[k], pdata[k]); 39 | 40 | do { 41 | be32enc(&endiandata[19], n); 42 | bmwhash(hash64, endiandata); 43 | if (hash64[7] < Htarg && fulltest(hash64, ptarget)) { 44 | *hashes_done = n - first_nonce + 1; 45 | pdata[19] = n; 46 | return true; 47 | } 48 | n++; 49 | 50 | } while (n < max_nonce && !work_restart[thr_id].restart); 51 | 52 | *hashes_done = n - first_nonce + 1; 53 | pdata[19] = n; 54 | 55 | return 0; 56 | } 57 | 58 | bool register_bmw256_algo( algo_gate_t* gate ) 59 | { 60 | algo_not_implemented(); 61 | return false; 62 | // gate->scanhash = (void*)&scanhash_bmw; 63 | // gate->hash = (void*)&bmwhash; 64 | return true; 65 | }; 66 | 67 | -------------------------------------------------------------------------------- /algo/bmw/bmw512-gate.c: -------------------------------------------------------------------------------- 1 | #include "bmw512-gate.h" 2 | 3 | bool register_bmw512_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | NEON_OPT; 6 | opt_target_factor = 256.0; 7 | #if defined (BMW512_8WAY) 8 | gate->scanhash = (void*)&scanhash_bmw512_8way; 9 | gate->hash = (void*)&bmw512hash_8way; 10 | #elif defined (BMW512_4WAY) 11 | gate->scanhash = (void*)&scanhash_bmw512_4way; 12 | gate->hash = (void*)&bmw512hash_4way; 13 | #elif defined (BMW512_2WAY) 14 | gate->scanhash = (void*)&scanhash_bmw512_2x64; 15 | gate->hash = (void*)&bmw512hash_2x64; 16 | #else 17 | gate->scanhash = (void*)&scanhash_bmw512; 18 | gate->hash = (void*)&bmw512hash; 19 | #endif 20 | return true; 21 | }; 22 | 23 | 24 | -------------------------------------------------------------------------------- /algo/bmw/bmw512-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef BMW512_GATE_H__ 2 | #define BMW512_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define BMW512_8WAY 1 9 | #elif defined(__AVX2__) 10 | #define BMW512_4WAY 1 11 | #elif defined(__SSE2__) || defined(__ARM_NEON) 12 | #define BMW512_2WAY 1 13 | #endif 14 | 15 | #if defined(BMW512_8WAY) 16 | 17 | void bmw512hash_8way( void *state, const void *input ); 18 | int scanhash_bmw512_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | 21 | #elif defined(BMW512_4WAY) 22 | 23 | void bmw512hash_4way( void *state, const void *input ); 24 | int scanhash_bmw512_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | #elif defined(BMW512_2WAY) 28 | 29 | void bmw512hash_2x64( void *state, const void *input ); 30 | int scanhash_bmw512_2x64( struct work *work, uint32_t max_nonce, 31 | uint64_t *hashes_done, struct thr_info *mythr ); 32 | 33 | #else 34 | 35 | void bmw512hash( void *state, const void *input ); 36 | int scanhash_bmw512( struct work *work, uint32_t max_nonce, 37 | uint64_t *hashes_done, struct thr_info *mythr ); 38 | 39 | #endif 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /algo/bmw/bmw512.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | 3 | #if !defined(BMW512_8WAY) && !defined(BMW512_4WAY) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "sph_bmw.h" 10 | 11 | void bmw512hash(void *state, const void *input) 12 | { 13 | sph_bmw512_context ctx; 14 | uint32_t hash[32]; 15 | 16 | sph_bmw512_init( &ctx ); 17 | sph_bmw512( &ctx,input, 80 ); 18 | sph_bmw512_close( &ctx, hash ); 19 | 20 | memcpy( state, hash, 32 ); 21 | } 22 | 23 | int scanhash_bmw512( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ) 25 | { 26 | uint32_t *pdata = work->data; 27 | uint32_t *ptarget = work->target; 28 | uint32_t n = pdata[19] - 1; 29 | const uint32_t first_nonce = pdata[19]; 30 | //const uint32_t Htarg = ptarget[7]; 31 | int thr_id = mythr->id; // thr_id arg is deprecated 32 | 33 | uint32_t _ALIGN(32) hash64[8]; 34 | uint32_t endiandata[32]; 35 | 36 | for (int i=0; i < 19; i++) 37 | be32enc(&endiandata[i], pdata[i]); 38 | 39 | do { 40 | 41 | pdata[19] = ++n; 42 | be32enc(&endiandata[19], n); 43 | bmw512hash(hash64, endiandata); 44 | if (((hash64[7]&0xFFFFFF00)==0) && 45 | fulltest(hash64, ptarget)) { 46 | *hashes_done = n - first_nonce + 1; 47 | return true; 48 | } 49 | } while (n < max_nonce && !work_restart[thr_id].restart); 50 | 51 | *hashes_done = n - first_nonce + 1; 52 | pdata[19] = n; 53 | return 0; 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /algo/cubehash/cube-hash-2way.h: -------------------------------------------------------------------------------- 1 | #ifndef CUBE_HASH_2WAY_H__ 2 | #define CUBE_HASH_2WAY_H__ 1 3 | 4 | #include 5 | #include "simd-utils.h" 6 | 7 | #if defined(__AVX2__) 8 | 9 | #if defined(SIMD512) 10 | 11 | struct _cube_4way_context 12 | { 13 | __m512i h[8]; 14 | int hashlen; 15 | int rounds; 16 | int blocksize; 17 | int pos; 18 | } __attribute__ ((aligned (128))); 19 | 20 | struct _cube_4way_2buf_context 21 | { 22 | __m512i h0[8]; 23 | __m512i h1[8]; 24 | int hashlen; 25 | int rounds; 26 | int blocksize; 27 | int pos; 28 | } __attribute__ ((aligned (128))); 29 | 30 | 31 | typedef struct _cube_4way_context cube_4way_context; 32 | 33 | typedef struct _cube_4way_2buf_context cube_4way_2buf_context; 34 | 35 | int cube_4way_init( cube_4way_context* sp, int hashbitlen, int rounds, 36 | int blockbytes ); 37 | 38 | int cube_4way_update( cube_4way_context *sp, const void *data, size_t size ); 39 | 40 | int cube_4way_close( cube_4way_context *sp, void *output ); 41 | 42 | int cube_4way_update_close( cube_4way_context *sp, void *output, 43 | const void *data, size_t size ); 44 | 45 | int cube_4way_full( cube_4way_context *sp, void *output, int hashbitlen, 46 | const void *data, size_t size ); 47 | 48 | int cube_4way_2buf_full( cube_4way_2buf_context *sp, 49 | void *output0, void *output1, int hashbitlen, 50 | const void *data0, const void *data1, size_t size ); 51 | 52 | #endif 53 | 54 | // 2x128, 2 way parallel AVX2 55 | 56 | struct _cube_2way_context 57 | { 58 | __m256i h[8]; 59 | int hashlen; // __m128i 60 | int rounds; 61 | int blocksize; // __m128i 62 | int pos; // number of __m128i read into x from current block 63 | } __attribute__ ((aligned (128))); 64 | 65 | typedef struct _cube_2way_context cube_2way_context; 66 | 67 | int cube_2way_init( cube_2way_context* sp, int hashbitlen, int rounds, 68 | int blockbytes ); 69 | int cube_2way_update( cube_2way_context *sp, const void *data, size_t size ); 70 | int cube_2way_close( cube_2way_context *sp, void *output ); 71 | int cube_2way_update_close( cube_2way_context *sp, void *output, 72 | const void *data, size_t size ); 73 | int cube_2way_full( cube_2way_context *sp, void *output, int hashbitlen, 74 | const void *data, size_t size ); 75 | 76 | 77 | #endif 78 | #endif 79 | -------------------------------------------------------------------------------- /algo/cubehash/cubehash_sse2.h: -------------------------------------------------------------------------------- 1 | #ifndef CUBEHASH_SSE2_H__ 2 | #define CUBEHASH_SSE2_H__ 3 | 4 | #include "compat.h" 5 | #include 6 | #include "simd-utils.h" 7 | 8 | /*!\brief Holds all the parameters necessary for the CUBEHASH algorithm. 9 | * \ingroup HASH_cubehash_m 10 | */ 11 | 12 | struct _cubehashParam 13 | { 14 | v128_t _ALIGN(64) x[8]; // aligned for __m512i 15 | int hashlen; // __m128i 16 | int rounds; 17 | int blocksize; // __m128i 18 | int pos; // number of __m128i read into x from current block 19 | }; 20 | 21 | typedef struct _cubehashParam cubehashParam; 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | int cubehashInit(cubehashParam* sp, int hashbitlen, int rounds, int blockbytes); 28 | // reinitialize context with same parameters, much faster. 29 | int cubehashReinit( cubehashParam* sp ); 30 | 31 | int cubehashUpdate(cubehashParam* sp, const void *data, size_t size); 32 | 33 | int cubehashDigest(cubehashParam* sp, void *digest); 34 | 35 | int cubehashUpdateDigest( cubehashParam *sp, void *digest, 36 | const void *data, size_t size ); 37 | 38 | int cubehash_full( cubehashParam* sp, void *digest, int hashbitlen, 39 | const void *data, size_t size ); 40 | 41 | #ifdef __cplusplus 42 | } 43 | #endif 44 | 45 | #endif /* H_CUBEHASH */ 46 | -------------------------------------------------------------------------------- /algo/echo/aes_ni/api.h: -------------------------------------------------------------------------------- 1 | #define CRYPTO_BYTES 64 2 | #define CRYPTO_VERSION "1.208" -------------------------------------------------------------------------------- /algo/echo/aes_ni/hash_api.h: -------------------------------------------------------------------------------- 1 | /* 2 | * file : hash_api.h 3 | * version : 1.0.208 4 | * date : 14.12.2010 5 | * 6 | * ECHO vperm implementation Hash API 7 | * 8 | * Cagdas Calik 9 | * ccalik@metu.edu.tr 10 | * Institute of Applied Mathematics, Middle East Technical University, Turkey. 11 | * 12 | */ 13 | 14 | 15 | #ifndef HASH_API_H 16 | #define HASH_API_H 17 | 18 | #ifdef __AES__ 19 | #define HASH_IMPL_STR "ECHO-aesni" 20 | #else 21 | #define HASH_IMPL_STR "ECHO-vperm" 22 | #endif 23 | 24 | 25 | #include "compat/sha3_common.h" 26 | 27 | #include "simd-utils.h" 28 | 29 | 30 | typedef struct 31 | { 32 | v128_t state[4][4]; 33 | BitSequence buffer[192]; 34 | v128_t k; 35 | v128_t hashsize; 36 | v128_t const1536; 37 | 38 | unsigned int uRounds; 39 | unsigned int uHashSize; 40 | unsigned int uBlockLength; 41 | unsigned int uBufferBytes; 42 | DataLength processed_bits; 43 | 44 | } hashState_echo __attribute__ ((aligned (64))); 45 | 46 | HashReturn init_echo(hashState_echo *state, int hashbitlen); 47 | 48 | HashReturn reinit_echo(hashState_echo *state); 49 | 50 | HashReturn update_echo(hashState_echo *state, const void *data, uint32_t databitlen); 51 | 52 | HashReturn final_echo(hashState_echo *state, void *hashval); 53 | 54 | HashReturn hash_echo(int hashbitlen, const void *data, uint32_t databitlen, void *hashval); 55 | 56 | HashReturn update_final_echo( hashState_echo *state, void *hashval, 57 | const void *data, uint32_t databitlen ); 58 | HashReturn echo_full( hashState_echo *state, void *hashval, 59 | int nHashSize, const void *data, uint32_t databitlen ); 60 | 61 | #endif // HASH_API_H 62 | 63 | -------------------------------------------------------------------------------- /algo/fugue/fugue-aesni.h: -------------------------------------------------------------------------------- 1 | /* 2 | * file : hash_api.h 3 | * version : 1.0.208 4 | * date : 14.12.2010 5 | * 6 | * Fugue vperm implementation Hash API 7 | * 8 | * Cagdas Calik 9 | * ccalik@metu.edu.tr 10 | * Institute of Applied Mathematics, Middle East Technical University, Turkey. 11 | * 12 | */ 13 | 14 | #ifndef FUGUE_HASH_API_H 15 | #define FUGUE_HASH_API_H 16 | 17 | #if ( defined(__SSE4_1__) && defined(__AES__) ) || ( defined(__ARM_NEON) && defined(__ARM_FEATURE_AES) ) 18 | 19 | #include "simd-utils.h" 20 | 21 | typedef struct 22 | { 23 | v128_t state[12]; 24 | unsigned int base; 25 | unsigned int uHashSize; 26 | unsigned int uBlockLength; 27 | unsigned int uBufferBytes; 28 | uint64_t processed_bits; 29 | uint8_t buffer[4]; 30 | 31 | } hashState_fugue __attribute__ ((aligned (64))); 32 | 33 | 34 | // These functions are deprecated, use the lower case macro aliases that use 35 | // the standard interface. This will be cleaned up at a later date. 36 | int fugue512_Init( hashState_fugue *state, int hashbitlen ); 37 | 38 | int fugue512_Update( hashState_fugue *state, const void *data, 39 | uint64_t databitlen ); 40 | 41 | int fugue512_Final( hashState_fugue *state, void *hashval ); 42 | 43 | #define fugue512_init( state ) \ 44 | fugue512_Init( state, 512 ) 45 | #define fugue512_update( state, data, len ) \ 46 | fugue512_Update( state, data, (len)<<3 ) 47 | #define fugue512_final \ 48 | fugue512_Final 49 | 50 | 51 | int fugue512_full( hashState_fugue *hs, void *hashval, const void *data, 52 | uint64_t databitlen); 53 | 54 | #endif // AES 55 | #endif // HASH_API_H 56 | 57 | -------------------------------------------------------------------------------- /algo/fugue/sph_fugue.h: -------------------------------------------------------------------------------- 1 | #ifndef SPH_FUGUE_H__ 2 | #define SPH_FUGUE_H__ 3 | 4 | #include 5 | #include "compat/sph_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C"{ 9 | #endif 10 | 11 | #define SPH_SIZE_fugue224 224 12 | 13 | #define SPH_SIZE_fugue256 256 14 | 15 | #define SPH_SIZE_fugue384 384 16 | 17 | #define SPH_SIZE_fugue512 512 18 | 19 | typedef struct { 20 | #ifndef DOXYGEN_IGNORE 21 | sph_u32 partial; 22 | unsigned partial_len; 23 | unsigned round_shift; 24 | sph_u32 S[36]; 25 | #if SPH_64 26 | sph_u64 bit_count; 27 | #else 28 | sph_u32 bit_count_high, bit_count_low; 29 | #endif 30 | #endif 31 | } sph_fugue_context; 32 | 33 | typedef sph_fugue_context sph_fugue224_context; 34 | 35 | typedef sph_fugue_context sph_fugue256_context; 36 | 37 | typedef sph_fugue_context sph_fugue384_context; 38 | 39 | typedef sph_fugue_context sph_fugue512_context; 40 | 41 | void sph_fugue224_init(void *cc); 42 | 43 | void sph_fugue224(void *cc, const void *data, size_t len); 44 | 45 | void sph_fugue224_close(void *cc, void *dst); 46 | 47 | void sph_fugue224_addbits_and_close( 48 | void *cc, unsigned ub, unsigned n, void *dst); 49 | 50 | void sph_fugue256_init(void *cc); 51 | 52 | void sph_fugue256(void *cc, const void *data, size_t len); 53 | 54 | void sph_fugue256_close(void *cc, void *dst); 55 | 56 | void sph_fugue256_addbits_and_close( 57 | void *cc, unsigned ub, unsigned n, void *dst); 58 | 59 | void sph_fugue384_init(void *cc); 60 | 61 | void sph_fugue384(void *cc, const void *data, size_t len); 62 | 63 | void sph_fugue384_close(void *cc, void *dst); 64 | 65 | void sph_fugue384_addbits_and_close( 66 | void *cc, unsigned ub, unsigned n, void *dst); 67 | 68 | void sph_fugue512_init(void *cc); 69 | 70 | void sph_fugue512(void *cc, const void *data, size_t len); 71 | 72 | void sph_fugue512_close(void *cc, void *dst); 73 | 74 | void sph_fugue512_addbits_and_close( 75 | void *cc, unsigned ub, unsigned n, void *dst); 76 | 77 | #define sph_fugue512_full( cc, dst, data, len ) \ 78 | do{ \ 79 | sph_fugue512_init( cc ); \ 80 | sph_fugue512( cc, data, len ); \ 81 | sph_fugue512_close( cc, dst ); \ 82 | }while(0) 83 | 84 | 85 | #ifdef __cplusplus 86 | } 87 | #endif 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /algo/groestl/aes_ni/README: -------------------------------------------------------------------------------- 1 | This package contains an implementation of the Groestl-512 hash 2 | function optimized for the Intel AES instructions. 3 | 4 | Authors are Krystian Matusiewicz, Günther A. Roland, Martin Schläffer 5 | 6 | There are no known present or future claims by a copyright holder that 7 | the distribution of this software infringes the copyright. In 8 | particular, the author of the software is not making such claims and 9 | does not intend to make such claims. 10 | 11 | Moreover, there are no known present or future claims by a patent 12 | holder that the use of this software infringes the patent. In 13 | particular, the author of the software is not making such claims and 14 | does not intend to make such claims. 15 | -------------------------------------------------------------------------------- /algo/groestl/aes_ni/api.h: -------------------------------------------------------------------------------- 1 | #define CRYPTO_BYTES 64 2 | #define CRYPTO_VERSION "2.2" 3 | -------------------------------------------------------------------------------- /algo/groestl/aes_ni/architectures: -------------------------------------------------------------------------------- 1 | amd64 2 | -------------------------------------------------------------------------------- /algo/groestl/aes_ni/implementors: -------------------------------------------------------------------------------- 1 | Krystian Matusiewicz 2 | Günther A. Roland 3 | Martin Schläffer 4 | -------------------------------------------------------------------------------- /algo/groestl/groestl-4way.c: -------------------------------------------------------------------------------- 1 | #include "groestl-gate.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #if defined(GROESTL_4WAY_VAES) 8 | 9 | #include "groestl512-hash-4way.h" 10 | 11 | void groestl_4way_hash( void *output, const void *input ) 12 | { 13 | uint32_t hash[16*4] __attribute__ ((aligned (128))); 14 | groestl512_4way_context ctx; 15 | 16 | groestl512_4way_init( &ctx, 64 ); 17 | groestl512_4way_update_close( &ctx, hash, input, 640 ); 18 | 19 | groestl512_4way_init( &ctx, 64 ); 20 | groestl512_4way_update_close( &ctx, hash, hash, 512 ); 21 | 22 | dintrlv_4x128( output, output+32, output+64, output+96, hash, 256 ); 23 | } 24 | 25 | int scanhash_groestl_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ) 27 | { 28 | uint32_t hash[8*4] __attribute__ ((aligned (128))); 29 | uint32_t vdata[24*4] __attribute__ ((aligned (64))); 30 | uint32_t *pdata = work->data; 31 | uint32_t *ptarget = work->target; 32 | uint32_t n = pdata[19]; 33 | const uint32_t first_nonce = pdata[19]; 34 | const uint32_t last_nonce = max_nonce - 4; 35 | uint32_t *noncep = vdata + 64+3; // 4*16 + 3 36 | int thr_id = mythr->id; 37 | const uint32_t Htarg = ptarget[7]; 38 | 39 | mm512_bswap32_intrlv80_4x128( vdata, pdata ); 40 | 41 | do 42 | { 43 | be32enc( noncep, n ); 44 | be32enc( noncep+ 4, n+1 ); 45 | be32enc( noncep+ 8, n+2 ); 46 | be32enc( noncep+12, n+3 ); 47 | 48 | groestl_4way_hash( hash, vdata ); 49 | pdata[19] = n; 50 | 51 | for ( int lane = 0; lane < 4; lane++ ) 52 | if ( ( hash+(lane<<3) )[7] <= Htarg ) 53 | if ( fulltest( hash+(lane<<3), ptarget) && !opt_benchmark ) 54 | { 55 | pdata[19] = n + lane; 56 | submit_solution( work, hash+(lane<<3), mythr ); 57 | } 58 | n += 4; 59 | } while ( ( n < last_nonce ) && !work_restart[thr_id].restart ); 60 | *hashes_done = n - first_nonce; 61 | return 0; 62 | } 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /algo/groestl/groestl-gate.c: -------------------------------------------------------------------------------- 1 | #include "groestl-gate.h" 2 | 3 | bool register_dmd_gr_algo( algo_gate_t *gate ) 4 | { 5 | #if defined (GROESTL_4WAY_VAES) 6 | gate->scanhash = (void*)&scanhash_groestl_4way; 7 | gate->hash = (void*)&groestl_4way_hash; 8 | #else 9 | init_groestl_ctx(); 10 | gate->scanhash = (void*)&scanhash_groestl; 11 | gate->hash = (void*)&groestlhash; 12 | #endif 13 | gate->optimizations = AES_OPT | VAES_OPT; 14 | return true; 15 | }; 16 | 17 | bool register_groestl_algo( algo_gate_t* gate ) 18 | { 19 | register_dmd_gr_algo( gate ); 20 | gate->gen_merkle_root = (void*)&sha256_gen_merkle_root; 21 | return true; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /algo/groestl/groestl-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef GROESTL_GATE_H__ 2 | #define GROESTL_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__VAES__) && defined(SIMD512) 8 | #define GROESTL_4WAY_VAES 1 9 | #endif 10 | 11 | bool register_dmd_gr_algo( algo_gate_t* gate ); 12 | 13 | bool register_groestl_algo( algo_gate_t* gate ); 14 | 15 | #if defined(GROESTL_4WAY_VAES) 16 | 17 | void groestl_4way_hash( void *state, const void *input ); 18 | int scanhash_groestl_4way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | 21 | #else 22 | 23 | void groestlhash( void *state, const void *input ); 24 | int scanhash_groestl( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | void init_groestl_ctx(); 27 | 28 | #endif 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /algo/groestl/groestl.c: -------------------------------------------------------------------------------- 1 | #include "groestl-gate.h" 2 | 3 | #if !defined(GROESTL_8WAY) && !defined(GROESTLX16R_4WAY) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #ifdef __AES__ 10 | #include "algo/groestl/aes_ni/hash-groestl.h" 11 | #else 12 | #include "sph_groestl.h" 13 | #endif 14 | 15 | typedef struct 16 | { 17 | #ifdef __AES__ 18 | hashState_groestl groestl1, groestl2; 19 | #else 20 | sph_groestl512_context groestl1, groestl2; 21 | #endif 22 | 23 | } groestl_ctx_holder; 24 | 25 | static groestl_ctx_holder groestl_ctx; 26 | 27 | void init_groestl_ctx() 28 | { 29 | #ifdef __AES__ 30 | init_groestl( &groestl_ctx.groestl1, 64 ); 31 | init_groestl( &groestl_ctx.groestl2, 64 ); 32 | #else 33 | sph_groestl512_init( &groestl_ctx.groestl1 ); 34 | sph_groestl512_init( &groestl_ctx.groestl2 ); 35 | #endif 36 | } 37 | 38 | void groestlhash( void *output, const void *input ) 39 | { 40 | uint32_t hash[16] __attribute__ ((aligned (64))); 41 | groestl_ctx_holder ctx __attribute__ ((aligned (64))); 42 | memcpy( &ctx, &groestl_ctx, sizeof(groestl_ctx) ); 43 | 44 | #ifdef __AES__ 45 | update_and_final_groestl( &ctx.groestl1, (char*)hash, 46 | (const char*)input, 640 ); 47 | 48 | update_and_final_groestl( &ctx.groestl2, (char*)hash, 49 | (const char*)hash, 512 ); 50 | #else 51 | sph_groestl512(&ctx.groestl1, input, 80); 52 | sph_groestl512_close(&ctx.groestl1, hash); 53 | 54 | sph_groestl512(&ctx.groestl2, hash, 64); 55 | sph_groestl512_close(&ctx.groestl2, hash); 56 | #endif 57 | memcpy(output, hash, 32); 58 | } 59 | 60 | int scanhash_groestl( struct work *work, uint32_t max_nonce, 61 | uint64_t *hashes_done, struct thr_info *mythr ) 62 | { 63 | uint32_t *pdata = work->data; 64 | uint32_t *ptarget = work->target; 65 | uint32_t endiandata[20] __attribute__ ((aligned (64))); 66 | const uint32_t first_nonce = pdata[19]; 67 | uint32_t nonce = first_nonce; 68 | int thr_id = mythr->id; // thr_id arg is deprecated 69 | 70 | if (opt_benchmark) 71 | ((uint32_t*)ptarget)[7] = 0x0000ff; 72 | 73 | swab32_array( endiandata, pdata, 20 ); 74 | 75 | do { 76 | const uint32_t Htarg = ptarget[7]; 77 | uint32_t hash[8] __attribute__ ((aligned (64))); 78 | be32enc(&endiandata[19], nonce); 79 | groestlhash(hash, endiandata); 80 | 81 | if (hash[7] <= Htarg ) 82 | if ( fulltest(hash, ptarget) && !opt_benchmark ) 83 | { 84 | pdata[19] = nonce; 85 | submit_solution( work, hash, mythr ); 86 | } 87 | nonce++; 88 | } while (nonce < max_nonce && !work_restart[thr_id].restart); 89 | 90 | pdata[19] = nonce; 91 | *hashes_done = pdata[19] - first_nonce + 1; 92 | return 0; 93 | } 94 | #endif 95 | -------------------------------------------------------------------------------- /algo/groestl/groestl512-hash-4way.h: -------------------------------------------------------------------------------- 1 | #if !defined(GROESTL512_HASH_4WAY_H__) 2 | #define GROESTL512_HASH_4WAY_H__ 1 3 | 4 | #include "simd-utils.h" 5 | #include 6 | #include 7 | #if defined(_WIN64) || defined(__WINDOWS__) 8 | #include 9 | #endif 10 | #include 11 | 12 | #if defined(__AVX2__) && defined(__VAES__) 13 | 14 | /* some sizes (number of bytes) */ 15 | #define ROWS (8) 16 | #define LENGTHFIELDLEN (ROWS) 17 | //#define COLS512 (8) 18 | #define COLS1024 (16) 19 | //#define SIZE512 ((ROWS)*(COLS512)) 20 | #define SIZE_1024 ((ROWS)*(COLS1024)) 21 | //#define ROUNDS512 (10) 22 | #define ROUNDS1024 (14) 23 | 24 | //#if LENGTH<=256 25 | //#define COLS (COLS512) 26 | //#define SIZE (SIZE512) 27 | //#define ROUNDS (ROUNDS512) 28 | //#else 29 | #define COLS (COLS1024) 30 | //#define SIZE (SIZE1024) 31 | #define ROUNDS (ROUNDS1024) 32 | //#endif 33 | 34 | #define SIZE512 (SIZE_1024/16) 35 | 36 | #if defined(SIMD512) 37 | 38 | typedef struct { 39 | __attribute__ ((aligned (128))) __m512i chaining[SIZE512]; 40 | __attribute__ ((aligned (64))) __m512i buffer[SIZE512]; 41 | int blk_count; // SIZE_m128i 42 | int buf_ptr; // __m128i offset 43 | int rem_ptr; 44 | } groestl512_4way_context; 45 | 46 | 47 | int groestl512_4way_init( groestl512_4way_context*, uint64_t ); 48 | 49 | int groestl512_4way_update( groestl512_4way_context*, const void*, 50 | uint64_t ); 51 | int groestl512_4way_close( groestl512_4way_context*, void* ); 52 | int groestl512_4way_update_close( groestl512_4way_context*, void*, 53 | const void*, uint64_t ); 54 | int groestl512_4way_full( groestl512_4way_context*, void*, 55 | const void*, uint64_t ); 56 | 57 | #endif // AVX512 58 | 59 | // AVX2 + VAES 60 | 61 | typedef struct { 62 | __attribute__ ((aligned (128))) __m256i chaining[SIZE512]; 63 | __attribute__ ((aligned (64))) __m256i buffer[SIZE512]; 64 | int blk_count; // SIZE_m128i 65 | int buf_ptr; // __m128i offset 66 | int rem_ptr; 67 | } groestl512_2way_context; 68 | 69 | 70 | int groestl512_2way_init( groestl512_2way_context*, uint64_t ); 71 | 72 | int groestl512_2way_update( groestl512_2way_context*, const void*, 73 | uint64_t ); 74 | int groestl512_2way_close( groestl512_2way_context*, void* ); 75 | int groestl512_2way_update_close( groestl512_2way_context*, void*, 76 | const void*, uint64_t ); 77 | int groestl512_2way_full( groestl512_2way_context*, void*, 78 | const void*, uint64_t ); 79 | 80 | 81 | #endif // VAES 82 | #endif // GROESTL512_HASH_4WAY_H__ 83 | -------------------------------------------------------------------------------- /algo/groestl/myr-groestl.c: -------------------------------------------------------------------------------- 1 | #include "myrgr-gate.h" 2 | 3 | #if !defined(MYRGR_8WAY) && !defined(MYRGR_4WAY) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #ifdef __AES__ 10 | #include "aes_ni/hash-groestl.h" 11 | #else 12 | #include "sph_groestl.h" 13 | #endif 14 | #include "algo/sha/sha256-hash.h" 15 | 16 | typedef struct { 17 | #ifdef __AES__ 18 | hashState_groestl groestl; 19 | #else 20 | sph_groestl512_context groestl; 21 | #endif 22 | } myrgr_ctx_holder; 23 | 24 | myrgr_ctx_holder myrgr_ctx; 25 | 26 | void init_myrgr_ctx() 27 | { 28 | #ifdef __AES__ 29 | init_groestl ( &myrgr_ctx.groestl, 64 ); 30 | #else 31 | sph_groestl512_init( &myrgr_ctx.groestl ); 32 | #endif 33 | } 34 | 35 | void myriad_hash(void *output, const void *input) 36 | { 37 | myrgr_ctx_holder ctx; 38 | memcpy( &ctx, &myrgr_ctx, sizeof(myrgr_ctx) ); 39 | 40 | uint32_t _ALIGN(32) hash[16]; 41 | 42 | #ifdef __AES__ 43 | update_groestl( &ctx.groestl, (char*)input, 640 ); 44 | final_groestl( &ctx.groestl, (char*)hash); 45 | #else 46 | sph_groestl512(&ctx.groestl, input, 80); 47 | sph_groestl512_close(&ctx.groestl, hash); 48 | #endif 49 | 50 | sha256_full( hash, hash, 64 ); 51 | 52 | memcpy(output, hash, 32); 53 | } 54 | 55 | int scanhash_myriad( struct work *work, uint32_t max_nonce, 56 | uint64_t *hashes_done, struct thr_info *mythr ) 57 | { 58 | uint32_t _ALIGN(64) endiandata[20]; 59 | uint32_t *pdata = work->data; 60 | uint32_t *ptarget = work->target; 61 | const uint32_t first_nonce = pdata[19]; 62 | uint32_t nonce = first_nonce; 63 | int thr_id = mythr->id; 64 | 65 | if (opt_benchmark) 66 | ((uint32_t*)ptarget)[7] = 0x0000ff; 67 | 68 | swab32_array( endiandata, pdata, 20 ); 69 | 70 | do { 71 | const uint32_t Htarg = ptarget[7]; 72 | uint32_t hash[8]; 73 | be32enc(&endiandata[19], nonce); 74 | myriad_hash(hash, endiandata); 75 | 76 | if (hash[7] <= Htarg ) 77 | if ( fulltest(hash, ptarget) && !opt_benchmark ) 78 | { 79 | pdata[19] = nonce; 80 | submit_solution( work, hash, mythr ); 81 | } 82 | nonce++; 83 | 84 | } while (nonce < max_nonce && !work_restart[thr_id].restart); 85 | 86 | pdata[19] = nonce; 87 | *hashes_done = pdata[19] - first_nonce + 1; 88 | return 0; 89 | } 90 | #endif 91 | -------------------------------------------------------------------------------- /algo/groestl/myrgr-gate.c: -------------------------------------------------------------------------------- 1 | #include "myrgr-gate.h" 2 | 3 | bool register_myriad_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (MYRGR_8WAY) 6 | init_myrgr_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_myriad_8way; 8 | gate->hash = (void*)&myriad_8way_hash; 9 | gate->optimizations = AES_OPT | AVX2_OPT | VAES_OPT; 10 | #elif defined (MYRGR_4WAY) 11 | init_myrgr_4way_ctx(); 12 | gate->scanhash = (void*)&scanhash_myriad_4way; 13 | gate->hash = (void*)&myriad_4way_hash; 14 | gate->optimizations = AES_OPT | SSE2_OPT | AVX2_OPT | VAES_OPT; 15 | #else 16 | init_myrgr_ctx(); 17 | gate->scanhash = (void*)&scanhash_myriad; 18 | gate->hash = (void*)&myriad_hash; 19 | gate->optimizations = AES_OPT | SSE2_OPT | AVX2_OPT | SHA256_OPT | VAES_OPT; 20 | #endif 21 | return true; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /algo/groestl/myrgr-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef MYRGR_GATE_H__ 2 | #define MYRGR_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__VAES__) && defined(SIMD512) 8 | #define MYRGR_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) && !defined(__SHA__) 10 | #define MYRGR_4WAY 1 11 | #endif 12 | 13 | #if defined(MYRGR_8WAY) 14 | 15 | void myriad_8way_hash( void *state, const void *input ); 16 | int scanhash_myriad_8way( struct work *work, uint32_t max_nonce, 17 | uint64_t *hashes_done, struct thr_info *mythr ); 18 | void init_myrgr_8way_ctx(); 19 | 20 | #elif defined(MYRGR_4WAY) 21 | 22 | void myriad_4way_hash( void *state, const void *input ); 23 | int scanhash_myriad_4way( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | void init_myrgr_4way_ctx(); 26 | 27 | #else 28 | 29 | void myriad_hash( void *state, const void *input ); 30 | int scanhash_myriad( struct work *work, uint32_t max_nonce, 31 | uint64_t *hashes_done, struct thr_info *mythr ); 32 | void init_myrgr_ctx(); 33 | 34 | #endif 35 | #endif 36 | -------------------------------------------------------------------------------- /algo/jh/jha-gate.c: -------------------------------------------------------------------------------- 1 | #include "jha-gate.h" 2 | 3 | 4 | bool register_jha_algo( algo_gate_t* gate ) 5 | { 6 | #if defined (JHA_4WAY) 7 | four_way_not_tested(); 8 | gate->scanhash = (void*)&scanhash_jha_4way; 9 | gate->hash = (void*)&jha_hash_4way; 10 | #else 11 | gate->scanhash = (void*)&scanhash_jha; 12 | gate->hash = (void*)&jha_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | opt_target_factor = 65536.0; 16 | return true; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /algo/jh/jha-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef JHA_GATE_H__ 2 | #define JHA_GATE_H__ 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | 8 | #if defined(__AVX2__) && defined(__AES__) 9 | #define JHA_4WAY 10 | #endif 11 | 12 | #if defined JHA_4WAY 13 | void jha_hash_4way( void *state, const void *input ); 14 | 15 | int scanhash_jha_4way( struct work *work, uint32_t max_nonce, 16 | uint64_t *hashes_done, struct thr_info *mythr ); 17 | #endif 18 | 19 | void jha_hash( void *state, const void *input ); 20 | 21 | int scanhash_jha( struct work *work, uint32_t max_nonce, 22 | uint64_t *hashes_done, struct thr_info *mythr ); 23 | 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /algo/keccak/keccak-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef KECCAK_GATE_H__ 2 | #define KECCAK_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define KECCAK_8WAY 1 9 | #elif defined(__AVX2__) 10 | #define KECCAK_4WAY 1 11 | #elif defined(__SSE2__) || defined(__ARM_NEON) 12 | #define KECCAK_2WAY 1 13 | #endif 14 | 15 | #if defined(SIMD512) 16 | #define SHA3D_8WAY 1 17 | #elif defined(__AVX2__) 18 | #define SHA3D_4WAY 1 19 | #elif defined(__SSE2__) || defined(__ARM_NEON) 20 | #define SHA3D_2WAY 1 21 | #endif 22 | 23 | extern int hard_coded_eb; 24 | 25 | #if defined(KECCAK_8WAY) 26 | 27 | void keccakhash_8way( void *state, const void *input ); 28 | int scanhash_keccak_8way( struct work *work, uint32_t max_nonce, 29 | uint64_t *hashes_done, struct thr_info *mythr ); 30 | 31 | #elif defined(KECCAK_4WAY) 32 | 33 | void keccakhash_4way( void *state, const void *input ); 34 | int scanhash_keccak_4way( struct work *work, uint32_t max_nonce, 35 | uint64_t *hashes_done, struct thr_info *mythr ); 36 | 37 | #elif defined(KECCAK_2WAY) 38 | 39 | void keccakhash_2x64( void *state, const void *input ); 40 | int scanhash_keccak_2x64( struct work *work, uint32_t max_nonce, 41 | uint64_t *hashes_done, struct thr_info *mythr ); 42 | 43 | #else 44 | 45 | void keccakhash( void *state, const void *input ); 46 | int scanhash_keccak( struct work *work, uint32_t max_nonce, 47 | uint64_t *hashes_done, struct thr_info *mythr ); 48 | 49 | #endif 50 | 51 | #if defined(SHA3D_8WAY) 52 | 53 | void sha3d_hash_8way( void *state, const void *input ); 54 | int scanhash_sha3d_8way( struct work *work, uint32_t max_nonce, 55 | uint64_t *hashes_done, struct thr_info *mythr ); 56 | 57 | #elif defined(SHA3D_4WAY) 58 | 59 | void sha3d_hash_4way( void *state, const void *input ); 60 | int scanhash_sha3d_4way( struct work *work, uint32_t max_nonce, 61 | uint64_t *hashes_done, struct thr_info *mythr ); 62 | 63 | #elif defined(SHA3D_2WAY) 64 | 65 | void sha3d_hash_2x64( void *state, const void *input ); 66 | int scanhash_sha3d_2x64( struct work *work, uint32_t max_nonce, 67 | uint64_t *hashes_done, struct thr_info *mythr ); 68 | 69 | #else 70 | 71 | void sha3d_hash( void *state, const void *input ); 72 | int scanhash_sha3d( struct work *work, uint32_t max_nonce, 73 | uint64_t *hashes_done, struct thr_info *mythr ); 74 | 75 | #endif 76 | #endif 77 | -------------------------------------------------------------------------------- /algo/keccak/keccak.c: -------------------------------------------------------------------------------- 1 | #include "keccak-gate.h" 2 | 3 | #if !defined(KECCAK_8WAY) && !defined(KECCAK_4WAY) 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | #include "sph_keccak.h" 10 | 11 | void keccakhash(void *state, const void *input) 12 | { 13 | sph_keccak256_context ctx_keccak; 14 | uint32_t hash[32]; 15 | 16 | sph_keccak256_init(&ctx_keccak); 17 | sph_keccak256 (&ctx_keccak,input, 80); 18 | sph_keccak256_close(&ctx_keccak, hash); 19 | 20 | memcpy(state, hash, 32); 21 | } 22 | 23 | int scanhash_keccak( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ) 25 | { 26 | uint32_t _ALIGN(64) hash64[8]; 27 | uint32_t _ALIGN(64) endiandata[32]; 28 | uint32_t *pdata = work->data; 29 | uint32_t *ptarget = work->target; 30 | uint32_t n = pdata[19]; 31 | const uint32_t first_nonce = pdata[19]; 32 | const uint32_t last_nonce = max_nonce; 33 | const int thr_id = mythr->id; 34 | 35 | for ( int i=0; i < 19; i++ ) 36 | be32enc( &endiandata[i], pdata[i] ); 37 | 38 | do { 39 | be32enc( &endiandata[19], n ); 40 | keccakhash( hash64, endiandata ); 41 | if ( valid_hash( hash64, ptarget ) && !opt_benchmark ) 42 | { 43 | pdata[19] = n; 44 | submit_solution( work, hash64, mythr ); 45 | } 46 | n++; 47 | } while ( n < last_nonce && !work_restart[thr_id].restart ); 48 | 49 | *hashes_done = n - first_nonce; 50 | pdata[19] = n; 51 | return 0; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /algo/keccak/sha3d.c: -------------------------------------------------------------------------------- 1 | #include "keccak-gate.h" 2 | 3 | #if !defined(KECCAK_8WAY) && !defined(KECCAK_4WAY) 4 | 5 | #include 6 | #include 7 | #include 8 | #include "sph_keccak.h" 9 | 10 | void sha3d_hash(void *state, const void *input) 11 | { 12 | uint32_t buffer[16]; 13 | sph_keccak256_context ctx_keccak; 14 | 15 | sph_keccak256_init( &ctx_keccak ); 16 | sph_keccak256 ( &ctx_keccak, input, 80 ); 17 | sph_keccak256_close( &ctx_keccak, buffer ); 18 | sph_keccak256_init( &ctx_keccak ); 19 | sph_keccak256 ( &ctx_keccak, buffer, 32 ); 20 | sph_keccak256_close( &ctx_keccak, state ); 21 | } 22 | 23 | int scanhash_sha3d( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ) 25 | { 26 | uint32_t _ALIGN(64) hash64[8]; 27 | uint32_t _ALIGN(64) endiandata[32]; 28 | uint32_t *pdata = work->data; 29 | uint32_t *ptarget = work->target; 30 | uint32_t n = pdata[19]; 31 | const uint32_t first_nonce = pdata[19]; 32 | const uint32_t last_nonce = max_nonce; 33 | const int thr_id = mythr->id; 34 | 35 | for ( int i=0; i < 19; i++ ) 36 | be32enc( &endiandata[i], pdata[i] ); 37 | 38 | do { 39 | be32enc( &endiandata[19], n ); 40 | sha3d_hash( hash64, endiandata ); 41 | if ( valid_hash( hash64, ptarget ) && !opt_benchmark ) 42 | { 43 | pdata[19] = n; 44 | submit_solution( work, hash64, mythr ); 45 | } 46 | n++; 47 | } while ( n < last_nonce && !work_restart[thr_id].restart ); 48 | 49 | *hashes_done = n - first_nonce; 50 | pdata[19] = n; 51 | return 0; 52 | } 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /algo/lanehash/lane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Sebastiaan Indesteege 3 | * 4 | * 5 | * Permission to use, copy, modify, and distribute this software for any 6 | * purpose with or without fee is hereby granted, provided that the above 7 | * copyright notice and this permission notice appear in all copies. 8 | * 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 | */ 17 | 18 | /* 19 | * Optimised ANSI-C implementation of LANE 20 | */ 21 | 22 | #ifndef LANE_H 23 | #define LANE_H 24 | 25 | #include 26 | #include 27 | 28 | typedef unsigned char BitSequence; 29 | typedef unsigned long long DataLength; 30 | 31 | //typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHBITLEN = 2, BAD_DATABITLEN = 3 } HashReturn; 32 | 33 | //typedef unsigned char u8; 34 | //typedef unsigned int u32; 35 | //typedef unsigned long long u64; 36 | 37 | typedef struct { 38 | int hashbitlen; 39 | uint64_t ctr; 40 | uint32_t h[16]; 41 | uint8_t buffer[128]; 42 | } hashState; 43 | 44 | void laneInit (hashState *state, int hashbitlen); 45 | void laneUpdate (hashState *state, const BitSequence *data, DataLength databitlen); 46 | void laneFinal (hashState *state, BitSequence *hashval); 47 | void laneHash (int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval); 48 | 49 | #endif /* LANE_H */ 50 | -------------------------------------------------------------------------------- /algo/luffa/luffa_for_sse2.h: -------------------------------------------------------------------------------- 1 | #if !defined(LUFFA_FOR_SSE2_H__) 2 | #define LUFFA_FOR_SSE2_H__ 1 3 | 4 | /* 5 | * luffa_for_sse2.h 6 | * Version 2.0 (Sep 15th 2009) 7 | * 8 | * Copyright (C) 2008-2009 Hitachi, Ltd. All rights reserved. 9 | * 10 | * Hitachi, Ltd. is the owner of this software and hereby grant 11 | * the U.S. Government and any interested party the right to use 12 | * this software for the purposes of the SHA-3 evaluation process, 13 | * notwithstanding that this software is copyrighted. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 16 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 17 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 18 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 19 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 20 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 21 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 22 | */ 23 | 24 | //#include 25 | //#include "compat/sha3-defs.h" 26 | /* The length of digests*/ 27 | #define DIGEST_BIT_LEN_224 224 28 | #define DIGEST_BIT_LEN_256 256 29 | #define DIGEST_BIT_LEN_384 384 30 | #define DIGEST_BIT_LEN_512 512 31 | 32 | /*********************************/ 33 | /* The parameters of Luffa */ 34 | #define MSG_BLOCK_BIT_LEN 256 /*The bit length of a message block*/ 35 | #define MSG_BLOCK_BYTE_LEN (MSG_BLOCK_BIT_LEN >> 3) /* The byte length 36 | * of a message block*/ 37 | 38 | /* The number of blocks in Luffa */ 39 | #define WIDTH_224 3 40 | #define WIDTH_256 3 41 | #define WIDTH_384 4 42 | #define WIDTH_512 5 43 | 44 | /* The limit of the length of message */ 45 | #define LIMIT_224 64 46 | #define LIMIT_256 64 47 | #define LIMIT_384 128 48 | #define LIMIT_512 128 49 | /*********************************/ 50 | 51 | typedef struct { 52 | uint32_t buffer[8] __attribute((aligned(32))); 53 | v128_t chainv[10] __attribute((aligned(32))); /* Chaining values */ 54 | int hashbitlen; 55 | int rembytes; 56 | } hashState_luffa; 57 | 58 | int init_luffa( hashState_luffa *state, int hashbitlen ); 59 | 60 | // len is in bytes 61 | int update_luffa( hashState_luffa *state, const void *data, 62 | size_t len ); 63 | 64 | int final_luffa( hashState_luffa *state, void *hashval ); 65 | 66 | int update_and_final_luffa( hashState_luffa *state, void* output, 67 | const void* data, size_t inlen ); 68 | 69 | int luffa_full( hashState_luffa *state, void* output, int hashbitlen, 70 | const void* data, size_t inlen ); 71 | #endif // LUFFA_FOR_SSE2_H__ 72 | -------------------------------------------------------------------------------- /algo/lyra2/lyra2h.c: -------------------------------------------------------------------------------- 1 | #include "lyra2-gate.h" 2 | 3 | #if !( defined(LYRA2H_8WAY) || defined(LYRA2H_4WAY) ) 4 | 5 | #include 6 | //#include 7 | #include "lyra2.h" 8 | #include "algo/blake/sph_blake.h" 9 | 10 | __thread uint64_t* lyra2h_matrix; 11 | 12 | bool lyra2h_thread_init() 13 | { 14 | lyra2h_matrix = mm_malloc( LYRA2H_MATRIX_SIZE, 64 ); 15 | return lyra2h_matrix; 16 | } 17 | 18 | static __thread sph_blake256_context lyra2h_blake_mid; 19 | 20 | void lyra2h_midstate( const void* input ) 21 | { 22 | sph_blake256_init( &lyra2h_blake_mid ); 23 | sph_blake256( &lyra2h_blake_mid, input, 64 ); 24 | } 25 | 26 | void lyra2h_hash( void *state, const void *input ) 27 | { 28 | uint32_t _ALIGN(64) hash[16]; 29 | 30 | sph_blake256_context ctx_blake __attribute__ ((aligned (64))); 31 | 32 | memcpy( &ctx_blake, &lyra2h_blake_mid, sizeof lyra2h_blake_mid ); 33 | sph_blake256( &ctx_blake, input + 64, 16 ); 34 | sph_blake256_close( &ctx_blake, hash ); 35 | 36 | LYRA2Z( lyra2h_matrix, hash, 32, hash, 32, hash, 32, 16, 16, 16 ); 37 | 38 | memcpy(state, hash, 32); 39 | } 40 | 41 | int scanhash_lyra2h( struct work *work, uint32_t max_nonce, 42 | uint64_t *hashes_done, struct thr_info *mythr ) 43 | { 44 | uint32_t _ALIGN(64) hash[8]; 45 | uint32_t _ALIGN(64) endiandata[20]; 46 | uint32_t *pdata = work->data; 47 | uint32_t *ptarget = work->target; 48 | const uint32_t Htarg = ptarget[7]; 49 | const uint32_t first_nonce = pdata[19]; 50 | uint32_t nonce = first_nonce; 51 | int thr_id = mythr->id; // thr_id arg is deprecated 52 | 53 | if (opt_benchmark) 54 | ptarget[7] = 0x0000ff; 55 | 56 | for (int i=0; i < 19; i++) { 57 | be32enc(&endiandata[i], pdata[i]); 58 | } 59 | 60 | lyra2h_midstate( endiandata ); 61 | do { 62 | be32enc(&endiandata[19], nonce); 63 | lyra2h_hash( hash, endiandata ); 64 | 65 | if ( hash[7] <= Htarg ) 66 | if ( fulltest( hash, ptarget ) && !opt_benchmark ) 67 | { 68 | pdata[19] = nonce; 69 | submit_solution( work, hash, mythr ); 70 | } 71 | nonce++; 72 | } while (nonce < max_nonce && !work_restart[thr_id].restart); 73 | pdata[19] = nonce; 74 | *hashes_done = pdata[19] - first_nonce + 1; 75 | return 0; 76 | } 77 | #endif 78 | -------------------------------------------------------------------------------- /algo/lyra2/lyra2z330.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "algo-gate-api.h" 3 | #include "lyra2.h" 4 | #include "simd-utils.h" 5 | 6 | static __thread uint64_t* lyra2z330_wholeMatrix; 7 | 8 | void lyra2z330_hash(void *state, const void *input, uint32_t height) 9 | { 10 | uint32_t _ALIGN(256) hash[16]; 11 | 12 | LYRA2Z( lyra2z330_wholeMatrix, hash, 32, input, 80, input, 80, 13 | 2, 330, 256 ); 14 | 15 | memcpy(state, hash, 32); 16 | } 17 | 18 | int scanhash_lyra2z330( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ) 20 | { 21 | uint32_t hash[8] __attribute__ ((aligned (128))); 22 | uint32_t edata[20] __attribute__ ((aligned (64))); 23 | uint32_t *pdata = work->data; 24 | uint32_t *ptarget = work->target; 25 | const uint32_t first_nonce = pdata[19]; 26 | uint32_t nonce = first_nonce; 27 | const int thr_id = mythr->id; 28 | 29 | if (opt_benchmark) 30 | ptarget[7] = 0x0000ff; 31 | 32 | casti_v128( edata, 0 ) = v128_bswap32( casti_v128( pdata, 0 ) ); 33 | casti_v128( edata, 1 ) = v128_bswap32( casti_v128( pdata, 1 ) ); 34 | casti_v128( edata, 2 ) = v128_bswap32( casti_v128( pdata, 2 ) ); 35 | casti_v128( edata, 3 ) = v128_bswap32( casti_v128( pdata, 3 ) ); 36 | casti_v128( edata, 4 ) = v128_bswap32( casti_v128( pdata, 4 ) ); 37 | 38 | do 39 | { 40 | edata[19] = nonce; 41 | 42 | LYRA2Z( lyra2z330_wholeMatrix, hash, 32, edata, 80, edata, 80, 43 | 2, 330, 256 ); 44 | 45 | // lyra2z330_hash( hash, edata, work->height ); 46 | if ( valid_hash( hash, ptarget ) && !opt_benchmark ) 47 | { 48 | be32enc( pdata + 19, nonce ); 49 | submit_solution( work, hash, mythr ); 50 | } 51 | nonce++; 52 | } while ( nonce < max_nonce && !work_restart[thr_id].restart ); 53 | pdata[19] = nonce; 54 | *hashes_done = nonce - first_nonce; 55 | return 0; 56 | } 57 | 58 | bool lyra2z330_thread_init() 59 | { 60 | const int64_t ROW_LEN_INT64 = BLOCK_LEN_INT64 * 256; // nCols 61 | const int64_t ROW_LEN_BYTES = ROW_LEN_INT64 * 8; 62 | 63 | int i = (int64_t)ROW_LEN_BYTES * 330; // nRows; 64 | lyra2z330_wholeMatrix = mm_malloc( i, 64 ); 65 | 66 | return lyra2z330_wholeMatrix; 67 | } 68 | 69 | bool register_lyra2z330_algo( algo_gate_t* gate ) 70 | { 71 | gate->optimizations = SSE2_OPT | AVX2_OPT | NEON_OPT; 72 | gate->miner_thread_init = (void*)&lyra2z330_thread_init; 73 | gate->scanhash = (void*)&scanhash_lyra2z330; 74 | gate->hash = (void*)&lyra2z330_hash; 75 | opt_target_factor = 256.0; 76 | return true; 77 | }; 78 | 79 | -------------------------------------------------------------------------------- /algo/nist5/nist5-gate.c: -------------------------------------------------------------------------------- 1 | #include "nist5-gate.h" 2 | 3 | bool register_nist5_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT; 6 | #if defined (NIST5_8WAY) 7 | gate->scanhash = (void*)&scanhash_nist5_8way; 8 | gate->hash = (void*)&nist5hash_8way; 9 | #elif defined (NIST5_4WAY) 10 | gate->scanhash = (void*)&scanhash_nist5_4way; 11 | gate->hash = (void*)&nist5hash_4way; 12 | #else 13 | gate->scanhash = (void*)&scanhash_nist5; 14 | gate->hash = (void*)&nist5hash; 15 | #endif 16 | return true; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /algo/nist5/nist5-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef NIST5_GATE_H__ 2 | #define NIST5_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define NIST5_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define NIST5_4WAY 1 11 | #endif 12 | 13 | #if defined(NIST5_8WAY) 14 | 15 | void nist5hash_8way( void *state, const void *input ); 16 | 17 | int scanhash_nist5_8way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | 20 | #elif defined(NIST5_4WAY) 21 | 22 | void nist5hash_4way( void *state, const void *input ); 23 | 24 | int scanhash_nist5_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | #else 28 | 29 | void nist5hash( void *state, const void *input ); 30 | 31 | int scanhash_nist5( struct work *work, uint32_t max_nonce, 32 | uint64_t *hashes_done, struct thr_info *mythr ); 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /algo/panama/panama-hash-4way.h: -------------------------------------------------------------------------------- 1 | #ifndef PANAMA_HASH_4WAY_H__ 2 | #define PANAMA_HASH_4WAY_H__ 1 3 | 4 | #include 5 | #include "simd-utils.h" 6 | 7 | /** 8 | * Output size (in bits) for PANAMA. 9 | */ 10 | #define SPH_SIZE_panama 256 11 | 12 | typedef struct { 13 | unsigned char data[32<<2]; 14 | v128_t buffer[32][8]; 15 | v128_t state[17]; 16 | unsigned data_ptr; 17 | unsigned buffer_ptr; 18 | } panama_4way_context __attribute__ ((aligned (64))); 19 | 20 | void panama_4way_init( void *cc ); 21 | 22 | void panama_4way_update( void *cc, const void *data, size_t len ); 23 | 24 | void panama_4way_close( void *cc, void *dst ); 25 | 26 | #if defined(__AVX2__) 27 | 28 | typedef struct { 29 | unsigned char data[32<<3]; 30 | __m256i buffer[32][8]; 31 | __m256i state[17]; 32 | unsigned data_ptr; 33 | unsigned buffer_ptr; 34 | } panama_8way_context __attribute__ ((aligned (128))); 35 | 36 | void panama_8way_init( void *cc ); 37 | 38 | void panama_8way_update( void *cc, const void *data, size_t len ); 39 | 40 | void panama_8way_close( void *cc, void *dst ); 41 | 42 | #endif 43 | #endif 44 | -------------------------------------------------------------------------------- /algo/quark/anime-gate.c: -------------------------------------------------------------------------------- 1 | #include "anime-gate.h" 2 | 3 | bool register_anime_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (ANIME_8WAY) 6 | gate->scanhash = (void*)&scanhash_anime_8way; 7 | gate->hash = (void*)&anime_8way_hash; 8 | #elif defined (ANIME_4WAY) 9 | gate->scanhash = (void*)&scanhash_anime_4way; 10 | gate->hash = (void*)&anime_4way_hash; 11 | #else 12 | init_anime_ctx(); 13 | gate->scanhash = (void*)&scanhash_anime; 14 | gate->hash = (void*)&anime_hash; 15 | #endif 16 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 17 | return true; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /algo/quark/anime-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef ANIME_GATE_H__ 2 | #define ANIME_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define ANIME_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define ANIME_4WAY 1 11 | #endif 12 | 13 | bool register_anime_algo( algo_gate_t* gate ); 14 | 15 | #if defined(ANIME_8WAY) 16 | 17 | void anime_8way_hash( void *state, const void *input ); 18 | int scanhash_anime_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | 21 | #elif defined(ANIME_4WAY) 22 | 23 | void anime_4way_hash( void *state, const void *input ); 24 | int scanhash_anime_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | #endif 28 | 29 | void anime_hash( void *state, const void *input ); 30 | int scanhash_anime( struct work *work, uint32_t max_nonce, 31 | uint64_t *hashes_done, struct thr_info *mythr ); 32 | void init_anime_ctx(); 33 | 34 | #endif 35 | 36 | -------------------------------------------------------------------------------- /algo/quark/hmq1725-gate.c: -------------------------------------------------------------------------------- 1 | #include "hmq1725-gate.h" 2 | 3 | bool register_hmq1725_algo( algo_gate_t* gate ) 4 | { 5 | #if defined(HMQ1725_8WAY) 6 | gate->scanhash = (void*)&scanhash_hmq1725_8way; 7 | gate->hash = (void*)&hmq1725_8way_hash; 8 | #elif defined(HMQ1725_4WAY) 9 | gate->scanhash = (void*)&scanhash_hmq1725_4way; 10 | gate->hash = (void*)&hmq1725_4way_hash; 11 | #else 12 | gate->scanhash = (void*)&scanhash_hmq1725; 13 | gate->hash = (void*)&hmq1725hash; 14 | #endif 15 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT 16 | | NEON_OPT; 17 | opt_target_factor = 65536.0; 18 | return true; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /algo/quark/hmq1725-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef HMQ1725_GATE_H__ 2 | #define HMQ1725_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define HMQ1725_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define HMQ1725_4WAY 1 11 | #endif 12 | 13 | bool register_hmq1725_algo( algo_gate_t* gate ); 14 | 15 | #if defined(HMQ1725_8WAY) 16 | 17 | void hmq1725_8way_hash( void *state, const void *input ); 18 | int scanhash_hmq1725_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | 21 | #elif defined(HMQ1725_4WAY) 22 | 23 | void hmq1725_4way_hash( void *state, const void *input ); 24 | int scanhash_hmq1725_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | #else 28 | 29 | void hmq1725hash( void *state, const void *input ); 30 | int scanhash_hmq1725( struct work *work, uint32_t max_nonce, 31 | uint64_t *hashes_done, struct thr_info *mythr ); 32 | 33 | #endif 34 | 35 | #endif // HMQ1725_GATE_H__ 36 | -------------------------------------------------------------------------------- /algo/quark/quark-gate.c: -------------------------------------------------------------------------------- 1 | #include "quark-gate.h" 2 | 3 | bool register_quark_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (QUARK_8WAY) 6 | init_quark_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_quark_8way; 8 | gate->hash = (void*)&quark_8way_hash; 9 | #elif defined (QUARK_4WAY) 10 | init_quark_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_quark_4way; 12 | gate->hash = (void*)&quark_4way_hash; 13 | #else 14 | gate->scanhash = (void*)&scanhash_quark; 15 | gate->hash = (void*)&quark_hash; 16 | #endif 17 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT 18 | | NEON_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/quark/quark-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef QUARK_GATE_H__ 2 | #define QUARK_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define QUARK_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define QUARK_4WAY 1 11 | #endif 12 | 13 | bool register_quark_algo( algo_gate_t* gate ); 14 | 15 | #if defined(QUARK_8WAY) 16 | 17 | void quark_8way_hash( void *state, const void *input ); 18 | int scanhash_quark_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | void init_quark_8way_ctx(); 21 | 22 | #elif defined(QUARK_4WAY) 23 | 24 | void quark_4way_hash( void *state, const void *input ); 25 | int scanhash_quark_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_quark_4way_ctx(); 28 | 29 | #else 30 | 31 | void quark_hash( void *state, const void *input ); 32 | int scanhash_quark( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | 35 | #endif 36 | #endif 37 | -------------------------------------------------------------------------------- /algo/qubit/deep-gate.c: -------------------------------------------------------------------------------- 1 | #include "deep-gate.h" 2 | 3 | bool register_deep_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (DEEP_2WAY) 6 | init_deep_2way_ctx(); 7 | gate->scanhash = (void*)&scanhash_deep_2way; 8 | gate->hash = (void*)&deep_2way_hash; 9 | #else 10 | init_deep_ctx(); 11 | gate->scanhash = (void*)&scanhash_deep; 12 | gate->hash = (void*)&deep_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | return true; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /algo/qubit/deep-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef DEEP_GATE_H__ 2 | #define DEEP_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define DEEP_2WAY 9 | #endif 10 | 11 | bool register_deep_algo( algo_gate_t* gate ); 12 | 13 | #if defined(DEEP_2WAY) 14 | 15 | void deep_2way_hash( void *state, const void *input ); 16 | int scanhash_deep_2way( struct work *work, uint32_t max_nonce, 17 | uint64_t *hashes_done, struct thr_info *mythr ); 18 | void init_deep_2way_ctx(); 19 | 20 | #endif 21 | 22 | void deep_hash( void *state, const void *input ); 23 | int scanhash_deep( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | void init_deep_ctx(); 26 | 27 | #endif 28 | 29 | -------------------------------------------------------------------------------- /algo/qubit/qubit-gate.c: -------------------------------------------------------------------------------- 1 | #include "qubit-gate.h" 2 | 3 | bool register_qubit_algo( algo_gate_t* gate ) 4 | { 5 | 6 | #if defined (QUBIT_4WAY) 7 | init_qubit_4way_ctx(); 8 | gate->scanhash = (void*)&scanhash_qubit_4way; 9 | gate->hash = (void*)&qubit_4way_hash; 10 | #elif defined (QUBIT_2WAY) 11 | init_qubit_2way_ctx(); 12 | gate->scanhash = (void*)&scanhash_qubit_2way; 13 | gate->hash = (void*)&qubit_2way_hash; 14 | #else 15 | init_qubit_ctx(); 16 | gate->scanhash = (void*)&scanhash_qubit; 17 | gate->hash = (void*)&qubit_hash; 18 | #endif 19 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT 20 | | NEON_OPT; 21 | return true; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /algo/qubit/qubit-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef QUBIT_GATE_H__ 2 | #define QUBIT_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | 8 | #if defined(SIMD512) 9 | #define QUBIT_4WAY 1 10 | #elif defined(__AVX2__) && defined(__AES__) 11 | #define QUBIT_2WAY 1 12 | #endif 13 | 14 | bool register_qubit_algo( algo_gate_t* gate ); 15 | 16 | #if defined(QUBIT_4WAY) 17 | 18 | void qubit_4way_hash( void *state, const void *input ); 19 | int scanhash_qubit_4way( struct work *work, uint32_t max_nonce, 20 | uint64_t *hashes_done, struct thr_info *mythr ); 21 | void init_qubit_4way_ctx(); 22 | 23 | #elif defined(QUBIT_2WAY) 24 | 25 | void qubit_2way_hash( void *state, const void *input ); 26 | int scanhash_qubit_2way( struct work *work, uint32_t max_nonce, 27 | uint64_t *hashes_done, struct thr_info *mythr ); 28 | void init_qubit_2way_ctx(); 29 | 30 | #endif 31 | 32 | void qubit_hash( void *state, const void *input ); 33 | int scanhash_qubit( struct work *work, uint32_t max_nonce, 34 | uint64_t *hashes_done, struct thr_info *mythr ); 35 | void init_qubit_ctx(); 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /algo/ripemd/lbry-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef LBRY_GATE_H__ 2 | #define LBRY_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | 8 | #if defined(SIMD512) 9 | #define LBRY_16WAY 1 10 | #elif defined(__AVX2__) 11 | #define LBRY_8WAY 1 12 | #endif 13 | /* 14 | #if !defined(__SHA__) 15 | #if defined(__AVX2__) 16 | #define LBRY_8WAY 17 | #endif 18 | #endif 19 | */ 20 | 21 | #define LBRY_NTIME_INDEX 25 22 | #define LBRY_NBITS_INDEX 26 23 | #define LBRY_NONCE_INDEX 27 24 | #define LBRY_WORK_DATA_SIZE 192 25 | #define LBRY_WORK_CMP_SIZE 76 // same as default 26 | 27 | bool register_lbry_algo( algo_gate_t* gate ); 28 | 29 | #if defined(LBRY_16WAY) 30 | 31 | void lbry_16way_hash( void *state, const void *input ); 32 | int scanhash_lbry_16way( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | #elif defined(LBRY_8WAY) 35 | 36 | void lbry_8way_hash( void *state, const void *input ); 37 | int scanhash_lbry_8way( struct work *work, uint32_t max_nonce, 38 | uint64_t *hashes_done, struct thr_info *mythr ); 39 | 40 | #elif defined(LBRY_4WAY) 41 | 42 | void lbry_4way_hash( void *state, const void *input ); 43 | int scanhash_lbry_4way( struct work *work, uint32_t max_nonce, 44 | uint64_t *hashes_done ); 45 | 46 | #else 47 | 48 | void lbry_hash( void *state, const void *input ); 49 | int scanhash_lbry( struct work *work, uint32_t max_nonce, 50 | uint64_t *hashes_done, struct thr_info *mythr ); 51 | #endif 52 | #endif 53 | -------------------------------------------------------------------------------- /algo/ripemd/ripemd-hash-4way.h: -------------------------------------------------------------------------------- 1 | #ifndef RIPEMD_HASH_4WAY_H__ 2 | #define RIPEMD_HASH_4WAY_H__ 3 | 4 | #include 5 | 6 | #if defined(__SSE4_2__) 7 | 8 | #include "simd-utils.h" 9 | 10 | typedef struct 11 | { 12 | __m128i buf[64>>2]; 13 | __m128i val[5]; 14 | uint32_t count_high, count_low; 15 | } __attribute__ ((aligned (64))) ripemd160_4way_context; 16 | 17 | void ripemd160_4way_init( ripemd160_4way_context *sc ); 18 | void ripemd160_4way_update( ripemd160_4way_context *sc, const void *data, 19 | size_t len ); 20 | void ripemd160_4way_close( ripemd160_4way_context *sc, void *dst ); 21 | 22 | #if defined (__AVX2__) 23 | 24 | typedef struct 25 | { 26 | __m256i buf[64>>2]; 27 | __m256i val[5]; 28 | uint32_t count_high, count_low; 29 | } __attribute__ ((aligned (128))) ripemd160_8way_context; 30 | 31 | void ripemd160_8way_init( ripemd160_8way_context *sc ); 32 | void ripemd160_8way_update( ripemd160_8way_context *sc, const void *data, 33 | size_t len ); 34 | void ripemd160_8way_close( ripemd160_8way_context *sc, void *dst ); 35 | 36 | #if defined(SIMD512) 37 | 38 | typedef struct 39 | { 40 | __m512i buf[64>>2]; 41 | __m512i val[5]; 42 | uint32_t count_high, count_low; 43 | } __attribute__ ((aligned (128))) ripemd160_16way_context; 44 | 45 | void ripemd160_16way_init( ripemd160_16way_context *sc ); 46 | void ripemd160_16way_update( ripemd160_16way_context *sc, const void *data, 47 | size_t len ); 48 | void ripemd160_16way_close( ripemd160_16way_context *sc, void *dst ); 49 | 50 | #endif // AVX512 51 | #endif // __AVX2__ 52 | #endif // __SSE4_2__ 53 | #endif // RIPEMD_HASH_4WAY_H__ 54 | -------------------------------------------------------------------------------- /algo/scrypt/scrypt-core-4way.h: -------------------------------------------------------------------------------- 1 | #ifndef SCRYPT_CORE_4WAY_H__ 2 | #define SCRYPT_CORE_4WAY_H__ 3 | 4 | #include "simd-utils.h" 5 | #include 6 | #include 7 | 8 | #if defined(SIMD512) 9 | 10 | void scrypt_core_16way( __m512i *X, __m512i *V, const uint32_t N ); 11 | 12 | // Serial SIMD over 4 way parallel 13 | void scrypt_core_simd128_4way( v128_t *X, v128_t *V, const uint32_t N ); 14 | 15 | // 4 way parallel over serial SIMD 16 | void scrypt_core_4way_simd128( __m512i *X, __m512i *V, const uint32_t N ); 17 | 18 | #endif 19 | 20 | #if defined(__AVX2__) 21 | 22 | void scrypt_core_8way( __m256i *X, __m256i *V, uint32_t N ); 23 | 24 | // 2 way parallel over SIMD128 25 | void scrypt_core_2way_simd128( __m256i *X, __m256i *V, const uint32_t N ); 26 | 27 | // Double buffered 2 way parallel over SIMD128 28 | void scrypt_core_2way_simd128_2buf( __m256i *X, __m256i *V, const uint32_t N ); 29 | 30 | // Triplee buffered 2 way parallel over SIMD128 31 | void scrypt_core_2way_simd128_3buf( __m256i *X, __m256i *V, const uint32_t N ); 32 | 33 | // Serial SIMD128 over 2 way parallel 34 | void scrypt_core_simd128_2way( uint64_t *X, uint64_t *V, const uint32_t N ); 35 | 36 | // Double buffered simd over parallel 37 | void scrypt_core_simd128_2way_2buf( uint64_t *X, uint64_t *V, const uint32_t N ); 38 | 39 | // Triple buffered 2 way 40 | void scrypt_core_simd128_2way_3buf( uint64_t *X, uint64_t *V, const uint32_t N ); 41 | 42 | // Quadruple buffered 43 | void scrypt_core_simd128_2way_4buf( uint64_t *X, uint64_t *V, const uint32_t N ); 44 | 45 | #endif 46 | 47 | // Parallel 4 way, 4x memory 48 | void scrypt_core_4way( v128_t *X, v128_t *V, const uint32_t N ); 49 | 50 | // Linear SIMD 1 way, 1x memory, lowest 51 | void scrypt_core_simd128( uint32_t *X, uint32_t *V, const uint32_t N ); 52 | 53 | // Double buffered, 2x memory 54 | void scrypt_core_simd128_2buf( uint32_t *X, uint32_t *V, const uint32_t N ); 55 | 56 | // Triple buffered 57 | void scrypt_core_simd128_3buf( uint32_t *X, uint32_t *V, const uint32_t N ); 58 | 59 | // Quadruple buffered, 4x memory 60 | void scrypt_core_simd128_4buf( uint32_t *X, uint32_t *V, const uint32_t N ); 61 | 62 | // For reference only 63 | void scrypt_core_1way( uint32_t *X, uint32_t *V, const uint32_t N ); 64 | 65 | #endif 66 | 67 | -------------------------------------------------------------------------------- /algo/sha/hmac-sha256-hash.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2005,2007,2009 Colin Percival 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * $FreeBSD: src/lib/libmd/sha256_Y.h,v 1.2 2006/01/17 15:35:56 phk Exp $ 27 | */ 28 | 29 | #ifndef HMAC_SHA256_H__ 30 | #define HMAC_SHA256_H__ 31 | 32 | #include 33 | #include 34 | #include "sha256-hash.h" 35 | 36 | typedef struct HMAC_SHA256Context 37 | { 38 | sha256_context ictx; 39 | sha256_context octx; 40 | } HMAC_SHA256_CTX; 41 | 42 | void SHA256_Buf( const void *, size_t len, uint8_t digest[32] ); 43 | void HMAC_SHA256_Init( HMAC_SHA256_CTX *, const void *, size_t ); 44 | void HMAC_SHA256_Update( HMAC_SHA256_CTX *, const void *, size_t ); 45 | void HMAC_SHA256_Final( void*, HMAC_SHA256_CTX * ); 46 | void HMAC_SHA256_Buf( const void *, size_t Klen, const void *, 47 | size_t len, uint8_t digest[32] ); 48 | 49 | /** 50 | * PBKDF2_SHA256(passwd, passwdlen, salt, saltlen, c, buf, dkLen): 51 | * Compute PBKDF2(passwd, salt, c, dkLen) using HMAC-SHA256 as the PRF, and 52 | * write the output to buf. The value dkLen must be at most 32 * (2^32 - 1). 53 | */ 54 | void PBKDF2_SHA256( const uint8_t *, size_t, const uint8_t *, size_t, 55 | uint64_t, uint8_t *, size_t); 56 | 57 | #endif // HMAC_SHA256_H__ 58 | -------------------------------------------------------------------------------- /algo/sha/sha1-hash.h: -------------------------------------------------------------------------------- 1 | #ifndef SHA1_HASH_H__ 2 | #define SHA1_HASH_H__ 1 3 | 4 | #include 5 | #include "simd-utils.h" 6 | #include "cpuminer-config.h" 7 | #include "sph_sha1.h" 8 | 9 | // SHA hooks for sha1, automaticaaly substituded in SPH 10 | #if defined(__x86_64__) && defined(__SHA__) 11 | 12 | void sha1_x86_sha_transform_le( uint32_t *state_out, const void *input, 13 | const uint32_t *state_in ); 14 | 15 | void sha1_x86_sha_transform_be( uint32_t *state_out, const void *input, 16 | const uint32_t *state_in ); 17 | 18 | #define sha1_transform_le sha1_x86_sha_transform_le 19 | #define sha1_transform_be sha1_x86_sha_transform_be 20 | 21 | #elif defined(__ARM_NEON) && defined(__ARM_FEATURE_SHA2) 22 | 23 | void sha1_neon_sha_transform_be( uint32_t *state_out, const void *input, 24 | const uint32_t *state_in ); 25 | void sha1_neon_sha_transform_le( uint32_t *state_out, const void *input, 26 | const uint32_t *state_in ); 27 | 28 | #define sha1_transform_le sha1_neon_sha_transform_le 29 | #define sha1_transform_be sha1_neon_sha_transform_be 30 | 31 | #else 32 | 33 | #define sha1_transform_le sph_sha1_transform_le 34 | #define sha1_transform_be sph_sha1_transform_be 35 | 36 | #endif 37 | 38 | #define sha1_full sph_sha1_full 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /algo/sha/sha256d-4way.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHA256D_4WAY_H__ 2 | #define __SHA256D_4WAY_H__ 1 3 | 4 | #include 5 | #include "algo-gate-api.h" 6 | 7 | #if defined(SIMD512) 8 | #define SHA256D_16WAY 1 9 | #elif defined(__SHA__) 10 | #define SHA256D_SHA 1 11 | #elif defined(__ARM_NEON) && defined(__ARM_FEATURE_SHA2) 12 | #define SHA256D_NEON_SHA2 1 13 | #elif defined(__AVX2__) 14 | #define SHA256D_8WAY 1 15 | #else 16 | #define SHA256D_4WAY 1 17 | #endif 18 | 19 | bool register_sha256d_algo( algo_gate_t* gate ); 20 | 21 | #if defined(SHA256D_16WAY) 22 | 23 | int scanhash_sha256d_16way( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | #endif 26 | 27 | #if defined(SHA256D_8WAY) 28 | 29 | int scanhash_sha256d_8way( struct work *work, uint32_t max_nonce, 30 | uint64_t *hashes_done, struct thr_info *mythr ); 31 | #endif 32 | 33 | #if defined(SHA256D_4WAY) 34 | 35 | int scanhash_sha256d_4way( struct work *work, uint32_t max_nonce, 36 | uint64_t *hashes_done, struct thr_info *mythr ); 37 | #endif 38 | 39 | #if defined(SHA256D_SHA) 40 | 41 | int scanhash_sha256d_sha( struct work *work, uint32_t max_nonce, 42 | uint64_t *hashes_done, struct thr_info *mythr ); 43 | 44 | #endif 45 | 46 | #if defined(SHA256D_NEON_SHA2) 47 | 48 | int scanhash_sha256d_neon_sha2( struct work *work, uint32_t max_nonce, 49 | uint64_t *hashes_done, struct thr_info *mythr ); 50 | 51 | #endif 52 | 53 | #endif 54 | 55 | -------------------------------------------------------------------------------- /algo/sha/sha256d.c: -------------------------------------------------------------------------------- 1 | #include "sha256-hash.h" 2 | #include "sha256d.h" 3 | 4 | void sha256d( void *hash, const void *data, int len ) 5 | { 6 | sha256_full( hash, data, len ); 7 | sha256_full( hash, hash, 32 ); 8 | } 9 | bool register_sha256d_algo( algo_gate_t* gate ) 10 | { 11 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | NEON_OPT; 12 | #if defined(SHA256D_16WAY) 13 | gate->scanhash = (void*)&scanhash_sha256d_16way; 14 | #elif defined(SHA256D_SHA) 15 | gate->optimizations = SSE2_OPT | SHA256_OPT; 16 | gate->scanhash = (void*)&scanhash_sha256d_sha; 17 | #elif defined(SHA256D_NEON_SHA2) 18 | gate->optimizations = NEON_OPT | SHA256_OPT; 19 | gate->scanhash = (void*)&scanhash_sha256d_neon_sha2; 20 | #elif defined(SHA256D_8WAY) 21 | gate->scanhash = (void*)&scanhash_sha256d_8way; 22 | #elif defined(SHA256D_4WAY) 23 | gate->scanhash = (void*)&scanhash_sha256d_4x32; 24 | #else 25 | gate->hash = (void*)&sha256d; 26 | #endif 27 | return true; 28 | }; 29 | 30 | -------------------------------------------------------------------------------- /algo/sha/sha256d.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHA256D_4WAY_H__ 2 | #define __SHA256D_4WAY_H__ 1 3 | 4 | #include 5 | #include "algo-gate-api.h" 6 | 7 | #if defined(SIMD512) 8 | #define SHA256D_16WAY 1 9 | #elif defined(__SHA__) 10 | #define SHA256D_SHA 1 11 | #elif defined(__ARM_NEON) && defined(__ARM_FEATURE_SHA2) 12 | #define SHA256D_NEON_SHA2 1 13 | #elif defined(__AVX2__) 14 | #define SHA256D_8WAY 1 15 | #else 16 | #define SHA256D_4WAY 1 17 | #endif 18 | 19 | bool register_sha256d_algo( algo_gate_t* gate ); 20 | 21 | #if defined(SHA256D_16WAY) 22 | 23 | int scanhash_sha256d_16way( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | #endif 26 | 27 | #if defined(SHA256D_8WAY) 28 | 29 | int scanhash_sha256d_8way( struct work *work, uint32_t max_nonce, 30 | uint64_t *hashes_done, struct thr_info *mythr ); 31 | #endif 32 | 33 | #if defined(SHA256D_4WAY) 34 | 35 | int scanhash_sha256d_4x32( struct work *work, uint32_t max_nonce, 36 | uint64_t *hashes_done, struct thr_info *mythr ); 37 | #endif 38 | 39 | #if defined(SHA256D_SHA) 40 | 41 | int scanhash_sha256d_sha( struct work *work, uint32_t max_nonce, 42 | uint64_t *hashes_done, struct thr_info *mythr ); 43 | 44 | #endif 45 | 46 | #if defined(SHA256D_NEON_SHA2) 47 | 48 | int scanhash_sha256d_neon_sha2( struct work *work, uint32_t max_nonce, 49 | uint64_t *hashes_done, struct thr_info *mythr ); 50 | 51 | #endif 52 | 53 | void sha256d( void *hash, const void *data, int len ); 54 | 55 | bool register_sha256d_algo( algo_gate_t* gate ); 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /algo/sha/sha256q.c: -------------------------------------------------------------------------------- 1 | #include "sha256t-gate.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "algo/sha/sha256-hash.h" 7 | 8 | static __thread sha256_context sha256q_ctx __attribute__ ((aligned (64))); 9 | 10 | void sha256q_midstate( const void* input ) 11 | { 12 | sha256_ctx_init( &sha256q_ctx ); 13 | sha256_update( &sha256q_ctx, input, 64 ); 14 | } 15 | 16 | int sha256q_hash( void* output, const void* input ) 17 | { 18 | uint32_t _ALIGN(64) hash[16]; 19 | const int midlen = 64; // bytes 20 | const int tail = 80 - midlen; // 16 21 | 22 | sha256_context ctx __attribute__ ((aligned (64))); 23 | memcpy( &ctx, &sha256q_ctx, sizeof sha256q_ctx ); 24 | 25 | sha256_update( &ctx, input + midlen, tail ); 26 | sha256_final( &ctx, hash ); 27 | 28 | sha256_full( hash, hash, 32 ); 29 | sha256_full( hash, hash, 32 ); 30 | sha256_full( output, hash, 32 ); 31 | 32 | return 1; 33 | } 34 | 35 | int scanhash_sha256q( struct work *work, uint32_t max_nonce, 36 | uint64_t *hashes_done, struct thr_info *mythr ) 37 | { 38 | uint32_t edata[20] __attribute__((aligned(64))); 39 | uint32_t hash[8] __attribute__((aligned(64))); 40 | uint32_t *pdata = work->data; 41 | uint32_t *ptarget = work->target; 42 | const uint32_t first_nonce = pdata[19]; 43 | const uint32_t last_nonce = max_nonce - 1; 44 | uint32_t n = first_nonce; 45 | const int thr_id = mythr->id; 46 | const bool bench = opt_benchmark; 47 | 48 | v128_bswap32_80( edata, pdata ); 49 | sha256q_midstate( edata ); 50 | 51 | do 52 | { 53 | edata[19] = n; 54 | if ( likely( sha256q_hash( hash, edata ) ) ) 55 | if ( unlikely( valid_hash( hash, ptarget ) && !bench ) ) 56 | { 57 | pdata[19] = bswap_32( n ); 58 | submit_solution( work, hash, mythr ); 59 | } 60 | n++; 61 | } while ( n < last_nonce && !work_restart[thr_id].restart ); 62 | *hashes_done = n - first_nonce; 63 | pdata[19] = n; 64 | return 0; 65 | } 66 | 67 | -------------------------------------------------------------------------------- /algo/sha/sha256t-gate.c: -------------------------------------------------------------------------------- 1 | #include "sha256t-gate.h" 2 | 3 | bool register_sha256t_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; 6 | #if defined(SHA256T_16WAY) 7 | gate->scanhash = (void*)&scanhash_sha256t_16way; 8 | #elif defined(SHA256T_SHA) 9 | gate->optimizations = SSE2_OPT | SHA256_OPT; 10 | gate->scanhash = (void*)&scanhash_sha256t_sha; 11 | #elif defined(SHA256T_NEON_SHA2) 12 | gate->optimizations = NEON_OPT | SHA256_OPT; 13 | gate->scanhash = (void*)&scanhash_sha256t_neon_sha2; 14 | #elif defined(SHA256T_8WAY) 15 | gate->scanhash = (void*)&scanhash_sha256t_8way; 16 | #elif defined(SHA256T_4WAY) 17 | gate->scanhash = (void*)&scanhash_sha256t_4way; 18 | #else 19 | gate->scanhash = (void*)&scanhash_sha256t; 20 | 21 | #endif 22 | return true; 23 | } 24 | 25 | bool register_sha256q_algo( algo_gate_t* gate ) 26 | { 27 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; 28 | #if defined(SHA256T_16WAY) 29 | gate->scanhash = (void*)&scanhash_sha256q_16way; 30 | gate->hash = (void*)&sha256q_16way_hash; 31 | //#elif defined(SHA256T_SHA) 32 | // gate->optimizations = SHA256_OPT; 33 | // gate->scanhash = (void*)&scanhash_sha256q; 34 | // gate->hash = (void*)&sha256q_hash; 35 | #elif defined(SHA256T_8WAY) 36 | gate->scanhash = (void*)&scanhash_sha256q_8way; 37 | gate->hash = (void*)&sha256q_8way_hash; 38 | #elif defined(SHA256T_4WAY) 39 | gate->scanhash = (void*)&scanhash_sha256q_4way; 40 | gate->hash = (void*)&sha256q_4way_hash; 41 | //#else 42 | // gate->scanhash = (void*)&scanhash_sha256q; 43 | // gate->hash = (void*)&sha256q_4way; 44 | #endif 45 | return true; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /algo/sha/sha256t-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef __SHA256T_GATE_H__ 2 | #define __SHA256T_GATE_H__ 1 3 | 4 | #include 5 | #include "algo-gate-api.h" 6 | 7 | #if defined(SIMD512) 8 | #define SHA256T_16WAY 1 9 | #elif defined(__SHA__) 10 | #define SHA256T_SHA 1 11 | #elif defined(__ARM_NEON) && defined(__ARM_FEATURE_SHA2) 12 | #define SHA256T_NEON_SHA2 1 13 | #elif defined(__AVX2__) 14 | #define SHA256T_8WAY 1 15 | #else 16 | #define SHA256T_4WAY 1 17 | #endif 18 | 19 | bool register_sha256t_algo( algo_gate_t* gate ); 20 | bool register_sha256q_algo( algo_gate_t* gate ); 21 | 22 | #if defined(SHA256T_16WAY) 23 | 24 | int scanhash_sha256t_16way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | void sha256q_16way_hash( void *output, const void *input ); 27 | int scanhash_sha256q_16way( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | #endif 30 | 31 | #if defined(SHA256T_8WAY) 32 | 33 | int scanhash_sha256t_8way( struct work *work, uint32_t max_nonce, 34 | uint64_t *hashes_done, struct thr_info *mythr ); 35 | void sha256q_8way_hash( void *output, const void *input ); 36 | int scanhash_sha256q_8way( struct work *work, uint32_t max_nonce, 37 | uint64_t *hashes_done, struct thr_info *mythr ); 38 | #endif 39 | 40 | #if defined(SHA256T_4WAY) 41 | 42 | int scanhash_sha256t_4way( struct work *work, uint32_t max_nonce, 43 | uint64_t *hashes_done, struct thr_info *mythr ); 44 | void sha256q_4way_hash( void *output, const void *input ); 45 | int scanhash_sha256q_4way( struct work *work, uint32_t max_nonce, 46 | uint64_t *hashes_done, struct thr_info *mythr ); 47 | #endif 48 | 49 | #if defined(SHA256T_SHA) 50 | 51 | int scanhash_sha256t_sha( struct work *work, uint32_t max_nonce, 52 | uint64_t *hashes_done, struct thr_info *mythr ); 53 | 54 | #endif 55 | 56 | #if defined(SHA256T_NEON_SHA2) 57 | 58 | int scanhash_sha256t_neon_sha2( struct work *work, uint32_t max_nonce, 59 | uint64_t *hashes_done, struct thr_info *mythr ); 60 | 61 | #endif 62 | 63 | int sha256t_hash( void *output, const void *input ); 64 | int scanhash_sha256t( struct work *work, uint32_t max_nonce, 65 | uint64_t *hashes_done, struct thr_info *mythr ); 66 | 67 | int sha256q_hash( void *output, const void *input ); 68 | int scanhash_sha256q( struct work *work, uint32_t max_nonce, 69 | uint64_t *hashes_done, struct thr_info *mythr ); 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /algo/shavite/shavite-hash-2way.h: -------------------------------------------------------------------------------- 1 | #ifndef SHAVITE_HASH_2WAY_H__ 2 | #define SHAVITE_HASH_2WAY_H__ 3 | 4 | #if defined(__AVX2__) 5 | 6 | #include "simd-utils.h" 7 | 8 | typedef struct { 9 | unsigned char buf[128<<1]; 10 | uint32_t h[16<<1]; 11 | size_t ptr; 12 | uint32_t count0, count1, count2, count3; 13 | } shavite512_2way_context __attribute__ ((aligned (64))); 14 | 15 | void shavite512_2way_init( shavite512_2way_context *ctx ); 16 | void shavite512_2way_update( shavite512_2way_context *ctx, const void *data, 17 | size_t len ); 18 | void shavite512_2way_close( shavite512_2way_context *ctx, void *dst ); 19 | void shavite512_2way_update_close( shavite512_2way_context *ctx, void *dst, 20 | const void *data, size_t len ); 21 | void shavite512_2way_full( shavite512_2way_context *ctx, void *dst, 22 | const void *data, size_t len ); 23 | 24 | #endif // AVX2 25 | 26 | #endif // SHAVITE_HASH_2WAY_H__ 27 | 28 | -------------------------------------------------------------------------------- /algo/shavite/shavite-hash-4way.h: -------------------------------------------------------------------------------- 1 | #ifndef SHAVITE_HASH_4WAY_H__ 2 | #define SHAVITE_HASH_4WAY_H__ 1 3 | 4 | #include "simd-utils.h" 5 | 6 | #if defined(__VAES__) && defined(SIMD512) 7 | 8 | typedef struct { 9 | unsigned char buf[128<<2]; 10 | uint32_t h[16<<2]; 11 | size_t ptr; 12 | uint32_t count0, count1, count2, count3; 13 | } shavite512_4way_context __attribute__ ((aligned (64))); 14 | 15 | void shavite512_4way_init( shavite512_4way_context *ctx ); 16 | void shavite512_4way_update( shavite512_4way_context *ctx, const void *data, 17 | size_t len ); 18 | void shavite512_4way_close( shavite512_4way_context *ctx, void *dst ); 19 | void shavite512_4way_update_close( shavite512_4way_context *ctx, void *dst, 20 | const void *data, size_t len ); 21 | void shavite512_4way_full( shavite512_4way_context *ctx, void *dst, 22 | const void *data, size_t len ); 23 | 24 | #endif // VAES 25 | 26 | #endif // SHAVITE_HASH_4WAY_H__ 27 | 28 | -------------------------------------------------------------------------------- /algo/simd/simd-hash-2way.h: -------------------------------------------------------------------------------- 1 | #ifndef SIMD_HASH_2WAY_H__ 2 | #define SIMD_HASH_2WAY_H__ 1 3 | 4 | #include "simd-utils.h" 5 | 6 | #if defined(__SSE2__) || defined (__ARM_NEON) 7 | 8 | typedef struct 9 | { 10 | uint32_t A[32]; 11 | uint8_t buffer[128]; 12 | uint64_t count; 13 | unsigned int hashbitlen; 14 | unsigned int blocksize; 15 | unsigned int n_feistels; 16 | } simd512_context __attribute__((aligned(64))); 17 | 18 | // datalen is bytes 19 | int simd512_ctx( simd512_context *ctx, void *hashval, const void *data, 20 | int datalen ); 21 | 22 | int simd512( void *hashval, const void *data, int datalen ); 23 | 24 | #endif 25 | 26 | #if defined(__AVX2__) 27 | 28 | typedef struct 29 | { 30 | uint32_t A[ 32*2 ]; 31 | uint8_t buffer[ 128*2 ]; 32 | uint64_t count; 33 | unsigned int hashbitlen; 34 | unsigned int blocksize; 35 | unsigned int n_feistels; 36 | } simd512_2way_context __attribute__((aligned(64))); 37 | #define simd_2way_context simd512_2way_context 38 | 39 | // databitlen is bits 40 | int simd_2way_init( simd_2way_context *state, int hashbitlen ); 41 | int simd_2way_update( simd_2way_context *state, const void *data, 42 | int databitlen ); 43 | int simd_2way_close( simd_2way_context *state, void *hashval ); 44 | int simd_2way_update_close( simd_2way_context *state, void *hashval, 45 | const void *data, int databitlen ); 46 | int simd512_2way_ctx( simd512_2way_context *state, void *hashval, 47 | const void *data, int datalen ); 48 | #define simd512_2way_full simd512_2way_ctx 49 | 50 | int simd512_2way( void *hashval, const void *data, int datalen ); 51 | 52 | #endif 53 | 54 | #if defined(SIMD512) 55 | 56 | typedef struct 57 | { 58 | uint32_t A[ 32*4 ]; 59 | uint8_t buffer[ 128*4 ]; 60 | uint64_t count; 61 | unsigned int hashbitlen; 62 | unsigned int blocksize; 63 | unsigned int n_feistels; 64 | } simd512_4way_context __attribute__((aligned(128))); 65 | #define simd_4way_context simd512_4way_context 66 | 67 | int simd_4way_init( simd_4way_context *state, int hashbitlen ); 68 | int simd_4way_update( simd_4way_context *state, const void *data, 69 | int databitlen ); 70 | int simd_4way_close( simd_4way_context *state, void *hashval ); 71 | int simd_4way_update_close( simd_4way_context *state, void *hashval, 72 | const void *data, int databitlen ); 73 | int simd512_4way_ctx( simd_4way_context *state, void *hashval, 74 | const void *data, int datalen ); 75 | #define simd512_4way_full simd512_4way_ctx 76 | 77 | int simd512_4way( void *hashval, const void *data, int datalen ); 78 | 79 | #endif 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /algo/simd/simd_iv.h: -------------------------------------------------------------------------------- 1 | #if !defined(SIMD_IV_H__) 2 | #define SIMD_IV_H__ 3 | 4 | u32 IV_224[] = { 5 | 0x33586e9f, 0x12fff033, 0xb2d9f64d, 0x6f8fea53, 6 | 0xde943106, 0x2742e439, 0x4fbab5ac, 0x62b9ff96, 7 | 0x22e7b0af, 0xc862b3a8, 0x33e00cdc, 0x236b86a6, 8 | 0xf64ae77c, 0xfa373b76, 0x7dc1ee5b, 0x7fb29ce8 9 | }; 10 | 11 | u32 IV_256[] = { 12 | 0x4d567983, 0x07190ba9, 0x8474577b, 0x39d726e9, 13 | 0xaaf3d925, 0x3ee20b03, 0xafd5e751, 0xc96006d3, 14 | 0xc2c2ba14, 0x49b3bcb4, 0xf67caf46, 0x668626c9, 15 | 0xe2eaa8d2, 0x1ff47833, 0xd0c661a5, 0x55693de1 16 | }; 17 | 18 | u32 IV_384[] = { 19 | 0x8a36eebc, 0x94a3bd90, 0xd1537b83, 0xb25b070b, 0xf463f1b5, 0xb6f81e20, 0x0055c339, 0xb4d144d1, 20 | 0x7360ca61, 0x18361a03, 0x17dcb4b9, 0x3414c45a, 0xa699a9d2, 0xe39e9664, 0x468bfe77, 0x51d062f8, 21 | 0xb9e3bfe8, 0x63bece2a, 0x8fe506b9, 0xf8cc4ac2, 0x7ae11542, 0xb1aadda1, 0x64b06794, 0x28d2f462, 22 | 0xe64071ec, 0x1deb91a8, 0x8ac8db23, 0x3f782ab5, 0x039b5cb8, 0x71ddd962, 0xfade2cea, 0x1416df71 23 | }; 24 | 25 | u32 IV_512[] = { 26 | 0x0ba16b95, 0x72f999ad, 0x9fecc2ae, 0xba3264fc, 0x5e894929, 0x8e9f30e5, 0x2f1daa37, 0xf0f2c558, 27 | 0xac506643, 0xa90635a5, 0xe25b878b, 0xaab7878f, 0x88817f7a, 0x0a02892b, 0x559a7550, 0x598f657e, 28 | 0x7eef60a1, 0x6b70e3e8, 0x9c1714d1, 0xb958e2a8, 0xab02675e, 0xed1c014f, 0xcd8d65bb, 0xfdb7a257, 29 | 0x09254899, 0xd699c7bc, 0x9019b6dc, 0x2b9022e4, 0x8fa14956, 0x21bf9bd3, 0xb94d0943, 0x6ffddc22 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /algo/skein/skein-gate.c: -------------------------------------------------------------------------------- 1 | #include "skein-gate.h" 2 | #include "skein-hash-4way.h" 3 | 4 | bool register_skein_algo( algo_gate_t* gate ) 5 | { 6 | #if defined(SKEIN_8WAY) 7 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT; 8 | gate->scanhash = (void*)&scanhash_skein_8way; 9 | gate->hash = (void*)&skeinhash_8way; 10 | #elif defined(SKEIN_4WAY) 11 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | SHA256_OPT | NEON_OPT; 12 | gate->scanhash = (void*)&scanhash_skein_4way; 13 | gate->hash = (void*)&skeinhash_4way; 14 | #elif defined(SKEIN_2WAY) 15 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | SHA256_OPT | NEON_OPT; 16 | gate->scanhash = (void*)&scanhash_skein_2x64; 17 | gate->hash = (void*)&skeinhash_2x64; 18 | #else 19 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | SHA256_OPT | NEON_OPT; 20 | gate->scanhash = (void*)&scanhash_skein; 21 | gate->hash = (void*)&skeinhash; 22 | #endif 23 | return true; 24 | }; 25 | 26 | bool register_skein2_algo( algo_gate_t* gate ) 27 | { 28 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | NEON_OPT; 29 | #if defined(SKEIN_8WAY) 30 | gate->scanhash = (void*)&scanhash_skein2_8way; 31 | #elif defined(SKEIN_4WAY) 32 | gate->scanhash = (void*)&scanhash_skein2_4way; 33 | #elif defined(SKEIN_2WAY) 34 | gate->scanhash = (void*)&scanhash_skein2_2x64; 35 | #else 36 | gate->scanhash = (void*)&scanhash_skein2; 37 | #endif 38 | return true; 39 | }; 40 | 41 | 42 | -------------------------------------------------------------------------------- /algo/skein/skein-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef __SKEIN_GATE_H__ 2 | #define __SKEIN_GATE_H__ 1 3 | #include 4 | #include "algo-gate-api.h" 5 | 6 | #if defined(SIMD512) 7 | #define SKEIN_8WAY 1 8 | #elif defined(__AVX2__) 9 | #define SKEIN_4WAY 1 10 | #elif defined(__SSE2__) || defined(__ARM_NEON) 11 | #define SKEIN_2WAY 1 12 | #endif 13 | 14 | #if defined(SKEIN_8WAY) 15 | 16 | void skeinhash_8way( void *output, const void *input ); 17 | int scanhash_skein_8way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | 20 | void skein2hash_8way( void *output, const void *input ); 21 | int scanhash_skein2_8way( struct work *work, uint32_t max_nonce, 22 | uint64_t* hashes_done, struct thr_info *mythr ); 23 | 24 | #elif defined(SKEIN_4WAY) 25 | 26 | void skeinhash_4way( void *output, const void *input ); 27 | int scanhash_skein_4way( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | 30 | void skein2hash_4way( void *output, const void *input ); 31 | int scanhash_skein2_4way( struct work *work, uint32_t max_nonce, 32 | uint64_t* hashes_done, struct thr_info *mythr ); 33 | 34 | #elif defined(SKEIN_2WAY) 35 | 36 | void skeinhash_2x64( void *output, const void *input ); 37 | int scanhash_skein_2x64( struct work *work, uint32_t max_nonce, 38 | uint64_t *hashes_done, struct thr_info *mythr ); 39 | 40 | void skein2hash_2x64( void *output, const void *input ); 41 | int scanhash_skein2_2x64( struct work *work, uint32_t max_nonce, 42 | uint64_t* hashes_done, struct thr_info *mythr ); 43 | 44 | #else 45 | 46 | void skeinhash( void *output, const void *input ); 47 | int scanhash_skein( struct work *work, uint32_t max_nonce, 48 | uint64_t *hashes_done, struct thr_info *mythr ); 49 | 50 | void skein2hash( void *output, const void *input ); 51 | int scanhash_skein2( struct work *work, uint32_t max_nonce, 52 | uint64_t *hashes_done, struct thr_info *mythr ); 53 | 54 | #endif 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /algo/skein/skein.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | 3 | #if !defined(SKEIN_8WAY) && !defined(SKEIN_4WAY) 4 | 5 | #include 6 | #include 7 | #include "sph_skein.h" 8 | #include "algo/sha/sha256-hash.h" 9 | 10 | void skeinhash(void *state, const void *input) 11 | { 12 | uint32_t hash[16] __attribute__ ((aligned (64))); 13 | sph_skein512_context ctx_skein; 14 | 15 | sph_skein512_init( &ctx_skein ); 16 | sph_skein512( &ctx_skein, input, 80 ); 17 | sph_skein512_close( &ctx_skein, hash ); 18 | 19 | sha256_full( hash, hash, 64 ); 20 | 21 | memcpy(state, hash, 32); 22 | } 23 | 24 | int scanhash_skein( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ) 26 | { 27 | uint32_t *pdata = work->data; 28 | uint32_t *ptarget = work->target; 29 | uint32_t hash64[8] __attribute__ ((aligned (64))); 30 | uint32_t endiandata[20] __attribute__ ((aligned (64))); 31 | const uint32_t Htarg = ptarget[7]; 32 | const uint32_t first_nonce = pdata[19]; 33 | uint32_t n = first_nonce; 34 | int thr_id = mythr->id; 35 | 36 | swab32_array( endiandata, pdata, 20 ); 37 | 38 | do { 39 | be32enc(&endiandata[19], n); 40 | skeinhash(hash64, endiandata); 41 | if (hash64[7] <= Htarg ) 42 | if ( fulltest(hash64, ptarget) && !opt_benchmark ) 43 | { 44 | pdata[19] = n; 45 | submit_solution( work, hash64, mythr ); 46 | } 47 | n++; 48 | 49 | } while (n < max_nonce && !work_restart[thr_id].restart); 50 | 51 | *hashes_done = n - first_nonce + 1; 52 | pdata[19] = n; 53 | 54 | return 0; 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /algo/skein/skein2.c: -------------------------------------------------------------------------------- 1 | #include "skein-gate.h" 2 | 3 | #if !defined(SKEIN_8WAY) && !defined(SKEIN_4WAY) 4 | 5 | #include 6 | #include 7 | 8 | #include "sph_skein.h" 9 | 10 | // ctx caching seems slower with this algo 11 | //typedef struct { 12 | // sph_skein512_context skein; 13 | //} skein2_ctx_holder; 14 | 15 | //skein2_ctx_holder skein2_ctx; 16 | 17 | //void init_skein2_ctx() 18 | //{ 19 | // sph_skein512_init(&skein2_ctx.skein); 20 | //} 21 | 22 | void skein2hash(void *output, const void *input) 23 | { 24 | sph_skein512_context ctx_skein; 25 | 26 | uint32_t hash[16] __attribute__ ((aligned (64))); 27 | 28 | sph_skein512_init(&ctx_skein); 29 | sph_skein512(&ctx_skein, input, 80); 30 | sph_skein512_close(&ctx_skein, hash); 31 | 32 | sph_skein512_init(&ctx_skein); 33 | sph_skein512(&ctx_skein, hash, 64); 34 | sph_skein512_close(&ctx_skein, hash); 35 | 36 | memcpy(output, hash, 32); 37 | } 38 | 39 | int scanhash_skein2( struct work *work, uint32_t max_nonce, 40 | uint64_t *hashes_done, struct thr_info *mythr ) 41 | { 42 | uint32_t *pdata = work->data; 43 | uint32_t *ptarget = work->target; 44 | uint32_t hash64[8] __attribute__ ((aligned (64))); 45 | uint32_t endiandata[20] __attribute__ ((aligned (64))); 46 | const uint32_t Htarg = ptarget[7]; 47 | const uint32_t first_nonce = pdata[19]; 48 | uint32_t n = first_nonce; 49 | int thr_id = mythr->id; 50 | 51 | swab32_array( endiandata, pdata, 20 ); 52 | 53 | do { 54 | be32enc(&endiandata[19], n); 55 | skein2hash(hash64, endiandata); 56 | if (hash64[7] <= Htarg ) 57 | if ( fulltest(hash64, ptarget) && !opt_benchmark ) 58 | { 59 | pdata[19] = n; 60 | submit_solution( work, hash64, mythr ); 61 | } 62 | n++; 63 | 64 | } while (n < max_nonce && !work_restart[thr_id].restart); 65 | 66 | *hashes_done = n - first_nonce + 1; 67 | pdata[19] = n; 68 | 69 | return 0; 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /algo/swifftx/inttypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | inttypes.h 3 | 4 | Contributors: 5 | Created by Marek Michalkiewicz 6 | 7 | THIS SOFTWARE IS NOT COPYRIGHTED 8 | 9 | This source code is offered for use in the public domain. You may 10 | use, modify or distribute it freely. 11 | 12 | This code is distributed in the hope that it will be useful, but 13 | WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 14 | DISCLAIMED. This includes but is not limited to warranties of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16 | */ 17 | 18 | #ifndef __INTTYPES_H_ 19 | #define __INTTYPES_H_ 20 | 21 | #include 22 | 23 | /* Use [u]intN_t if you need exactly N bits. 24 | XXX - doesn't handle the -mint8 option. */ 25 | 26 | typedef signed char swift_int8_t; 27 | typedef unsigned char swift_uint8_t; 28 | 29 | typedef int32_t swift_int16_t; 30 | // typedef int swift_int16_t; 31 | typedef unsigned int swift_uint16_t; 32 | 33 | typedef int32_t swift_int32_t; 34 | // typedef long swift_int32_t; 35 | typedef unsigned long swift_uint32_t; 36 | 37 | typedef long long swift_int64_t; 38 | typedef unsigned long long swift_uint64_t; 39 | 40 | //typedef swift_int16_t intptr_t; 41 | //typedef swift_uint16_t uintptr_t; 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /algo/swifftx/stdint.h: -------------------------------------------------------------------------------- 1 | #ifndef _SWIFFT_STDINT_H 2 | #define _SWIFFT_STDINT_H 3 | 4 | /////////////////////////////////////////////////////////////////////////////////////////////// 5 | // 6 | // A note from SWIFFTX implementers: 7 | // 8 | // Although the submission was targeted for Microsoft Visual Studio 2005 compiler, we strived 9 | // to make the code as portable as possible. This is why we preferred to use the types defined 10 | // here, instead of Microsoft-specific types. We compiled the code with gcc to make this sure. 11 | // However, we couldn't use this header as is, due to VS2005 compiler objections. This is why 12 | // we commented out certain defines and clearly marked it. 13 | // To compile our code on gcc you may define SYS_STDINT. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifdef SYS_STDINT 18 | 19 | #include 20 | 21 | #else 22 | 23 | #include "inttypes.h" 24 | // The following was commented out by SWIFFTX implementers: 25 | // __BEGIN_DECLS 26 | 27 | typedef swift_int8_t swifftx_int_least8_t; 28 | typedef swift_int16_t swifftx_int_least16_t; 29 | typedef swift_int32_t swifftx_int_least32_t; 30 | typedef swift_uint8_t swifftx_uint_least8_t; 31 | typedef swift_uint16_t swifftx_uint_least16_t; 32 | typedef swift_uint32_t swifftx_uint_least32_t; 33 | 34 | #ifndef __STRICT_ANSI__ 35 | typedef swift_int64_t swifftx_int_least64_t; 36 | typedef swift_uint64_t swifftx_uint_least64_t; 37 | #endif 38 | 39 | /*typedef signed char int_fast8_t; 40 | typedef signed long int int_fast16_t; 41 | typedef signed long int int_fast32_t; 42 | typedef signed long long int int_fast64_t; 43 | 44 | typedef unsigned char uint_fast8_t; 45 | typedef unsigned long int uint_fast16_t; 46 | typedef unsigned long int uint_fast32_t; 47 | typedef unsigned long long int uint_fast64_t;*/ 48 | 49 | // The following was commented out by SWIFFTX implementers: 50 | // #include 51 | // __END_DECLS 52 | #endif 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /algo/verthash/Verthash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018-2021 CryptoGraphics 3 | * 4 | * This program is free software; you can redistribute it and/or modify it 5 | * under the terms of the GNU General Public License as published by the Free 6 | * Software Foundation; either version 2 of the License, or (at your option) 7 | * any later version. See LICENSE for more details. 8 | */ 9 | 10 | #ifndef Verthash_INCLUDE_ONCE 11 | #define Verthash_INCLUDE_ONCE 12 | 13 | #include "tiny_sha3/sha3.h" 14 | #include "fopen_utf8.h" 15 | 16 | #include 17 | #include 18 | #include 19 | #include 20 | 21 | // Verthash constants used to compute bitmask, used inside kernel during IO pass 22 | #define VH_HASH_OUT_SIZE 32 23 | #define VH_BYTE_ALIGNMENT 16 24 | #define VH_HEADER_SIZE 80 25 | 26 | //----------------------------------------------------------------------------- 27 | // Verthash data 28 | //! Verthash C api for data maniputation. 29 | typedef struct VerthashInfo 30 | { 31 | char* fileName; 32 | uint8_t* data; 33 | uint64_t dataSize; 34 | uint32_t bitmask; 35 | } verthash_info_t; 36 | 37 | //! Must be called before usage. Reset all fields and set a mining data file name. 38 | //! Error codes 39 | //! 0 - Success(No error). 40 | //! 1 - File name is invalid. 41 | //! 2 - Memory allocation error 42 | int verthash_info_init(verthash_info_t* info, const char* file_name); 43 | 44 | //! Reset all fields and free allocated data. 45 | void verthash_info_free(verthash_info_t* info); 46 | 47 | //! Generate verthash data file and save it to specified location. 48 | int verthash_generate_data_file(const char* output_file_name); 49 | 50 | void verthash_hash( const void *blob_bytes, const size_t blob_size, 51 | const void *input, void *output ); 52 | 53 | void verthash_sha3_512_prehash_72( const void *input ); 54 | void verthash_sha3_512_final_8( void *hash, const uint64_t nonce ); 55 | 56 | #endif // !Verthash_INCLUDE_ONCE 57 | 58 | -------------------------------------------------------------------------------- /algo/verthash/fopen_utf8.h: -------------------------------------------------------------------------------- 1 | #ifndef H_FOPEN_UTF8 2 | #define H_FOPEN_UTF8 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | int utf8_char_size(const uint8_t *c); 13 | uint32_t utf8_to_unicode32(const uint8_t *c, size_t *index); 14 | int codepoint_utf16_size(uint32_t c); 15 | uint16_t *sprint_utf16(uint16_t *str, uint32_t c); 16 | size_t strlen_utf8_to_utf16(const uint8_t *str); 17 | uint16_t *utf8_to_utf16(const uint8_t *utf8, uint16_t *utf16); 18 | 19 | FILE *fopen_utf8(const char *path, const char *mode); 20 | 21 | #ifdef __cplusplus 22 | } 23 | #endif 24 | #endif 25 | 26 | -------------------------------------------------------------------------------- /algo/verthash/tiny_sha3/sha3-4way.h: -------------------------------------------------------------------------------- 1 | // sha3.h 2 | // 19-Nov-11 Markku-Juhani O. Saarinen 3 | // 2021-03-27 JayDDee 4 | // 5 | #ifndef SHA3_4WAY_H 6 | #define SHA3_4WAY_H 7 | 8 | #include 9 | #include 10 | #include "simd-utils.h" 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | #ifndef KECCAKF_ROUNDS 17 | #define KECCAKF_ROUNDS 24 18 | #endif 19 | 20 | #if defined(__AVX2__) 21 | 22 | typedef struct 23 | { 24 | __m256i st[25]; // 64-bit words * 4 lanes 25 | int pt, rsiz, mdlen; // these don't overflow 26 | } sha3_4way_ctx_t __attribute__ ((aligned (64)));; 27 | 28 | // Compression function. 29 | void sha3_4way_keccakf( __m256i st[25] ); 30 | 31 | // OpenSSL - like interfece 32 | int sha3_4way_init( sha3_4way_ctx_t *c, int mdlen ); // mdlen = hash output in bytes 33 | int sha3_4way_update( sha3_4way_ctx_t *c, const void *data, size_t len ); 34 | int sha3_4way_final( void *md, sha3_4way_ctx_t *c ); // digest goes to md 35 | 36 | // compute a sha3 hash (md) of given byte length from "in" 37 | void *sha3_4way( const void *in, size_t inlen, void *md, int mdlen ); 38 | 39 | 40 | #if defined(SIMD512) 41 | 42 | // state context 43 | typedef struct 44 | { 45 | __m512i st[25]; // 64-bit words * 8 lanes 46 | int pt, rsiz, mdlen; // these don't overflow 47 | } sha3_8way_ctx_t __attribute__ ((aligned (64)));; 48 | 49 | // Compression function. 50 | void sha3_8way_keccakf( __m512i st[25] ); 51 | 52 | // OpenSSL - like interfece 53 | int sha3_8way_init( sha3_8way_ctx_t *c, int mdlen ); // mdlen = hash output in bytes 54 | int sha3_8way_update( sha3_8way_ctx_t *c, const void *data, size_t len ); 55 | int sha3_8way_final( void *md, sha3_8way_ctx_t *c ); // digest goes to md 56 | 57 | // compute a sha3 hash (md) of given byte length from "in" 58 | void *sha3_8way( const void *in, size_t inlen, void *md, int mdlen ); 59 | 60 | #endif // AVX512 61 | #endif // AVX2 62 | 63 | #if defined(__cplusplus) 64 | } 65 | #endif 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /algo/verthash/tiny_sha3/sha3.h: -------------------------------------------------------------------------------- 1 | // sha3.h 2 | // 19-Nov-11 Markku-Juhani O. Saarinen 3 | 4 | #ifndef SHA3_H 5 | #define SHA3_H 6 | 7 | #include 8 | #include 9 | 10 | 11 | #if defined(__cplusplus) 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef KECCAKF_ROUNDS 16 | #define KECCAKF_ROUNDS 24 17 | #endif 18 | 19 | #ifndef ROTL64 20 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y)))) 21 | #endif 22 | 23 | // state context 24 | typedef struct { 25 | union { // state: 26 | uint8_t b[200]; // 8-bit bytes 27 | uint64_t q[25]; // 64-bit words 28 | } st; 29 | int pt, rsiz, mdlen; // these don't overflow 30 | } sha3_ctx_t; 31 | 32 | // Compression function. 33 | void sha3_keccakf(uint64_t st[25]); 34 | 35 | // OpenSSL - like interfece 36 | int sha3_init(sha3_ctx_t *c, int mdlen); // mdlen = hash output in bytes 37 | int sha3_update(sha3_ctx_t *c, const void *data, size_t len); 38 | int sha3_final(void *md, sha3_ctx_t *c); // digest goes to md 39 | 40 | // compute a sha3 hash (md) of given byte length from "in" 41 | void *sha3(const void *in, size_t inlen, void *md, int mdlen); 42 | 43 | // SHAKE128 and SHAKE256 extensible-output functions 44 | #define shake128_init(c) sha3_init(c, 16) 45 | #define shake256_init(c) sha3_init(c, 32) 46 | #define shake_update sha3_update 47 | 48 | void shake_xof(sha3_ctx_t *c); 49 | void shake_out(sha3_ctx_t *c, void *out, size_t len); 50 | 51 | #if defined(__cplusplus) 52 | } 53 | #endif 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /algo/whirlpool/whirlpool-gate.c: -------------------------------------------------------------------------------- 1 | #include "whirlpool-gate.h" 2 | 3 | bool register_whirlpool_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (WHIRLPOOL_4WAY) 6 | four_way_not_tested(); 7 | gate->optimizations = AVX2_OPT; 8 | gate->scanhash = (void*)&scanhash_whirlpool_4way; 9 | gate->hash = (void*)&whirlpool_hash_4way; 10 | #else 11 | gate->scanhash = (void*)&scanhash_whirlpool; 12 | gate->hash = (void*)&whirlpool_hash; 13 | init_whirlpool_ctx(); 14 | #endif 15 | return true; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /algo/whirlpool/whirlpool-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef WHIRLPOOL_GATE_H__ 2 | #define WHIRLPOOL_GATE_H__ 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | /* 8 | #if defined(FOUR_WAY) && defined(__AVX2__) 9 | #define WHIRLPOOL_4WAY 10 | #endif 11 | */ 12 | 13 | #if defined (WHIRLPOOL_4WAY) 14 | 15 | void whirlpool_hash_4way(void *state, const void *input); 16 | 17 | int scanhash_whirlpool_4way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | #else 20 | 21 | void whirlpool_hash( void *state, const void *input ); 22 | 23 | int scanhash_whirlpool( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | void init_whirlpool_ctx(); 26 | #endif 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /algo/whirlpool/whirlpoolx.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "sph_whirlpool.h" 8 | 9 | void whirlpoolx_hash(void *state, const void *input) 10 | { 11 | sph_whirlpool_context ctx_whirlpool; 12 | 13 | unsigned char hash[64]; 14 | // unsigned char hash_xored[32]; 15 | 16 | sph_whirlpool1_init(&ctx_whirlpool); 17 | sph_whirlpool1(&ctx_whirlpool, input, 80); 18 | sph_whirlpool1_close(&ctx_whirlpool, hash); 19 | 20 | // compress the 48 first bytes of the hash to 32 21 | // for (int i = 0; i < 32; i++) 22 | // hash_xored[i] = hash[i] ^ hash[i + 16]; 23 | 24 | memcpy(state, hash, 32); 25 | } 26 | 27 | int scanhash_whirlpoolx( struct work* work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ) 29 | { 30 | uint32_t _ALIGN(128) endiandata[20]; 31 | uint32_t* pdata = work->data; 32 | uint32_t* ptarget = work->target; 33 | const uint32_t first_nonce = pdata[19]; 34 | uint32_t n = first_nonce - 1; 35 | int thr_id = mythr->id; // thr_id arg is deprecated 36 | 37 | if (opt_benchmark) 38 | ((uint32_t*)ptarget)[7] = 0x0000ff; 39 | 40 | for (int i=0; i < 19; i++) 41 | be32enc(&endiandata[i], pdata[i]); 42 | 43 | do { 44 | const uint32_t Htarg = ptarget[7]; 45 | uint32_t vhash[8]; 46 | pdata[19] = ++n; 47 | be32enc(&endiandata[19], n ); 48 | whirlpoolx_hash(vhash, endiandata); 49 | 50 | if (vhash[7] <= Htarg && fulltest(vhash, ptarget)) 51 | submit_solution( work, vhash, mythr ); 52 | 53 | } while ( n < max_nonce && !work_restart[thr_id].restart); 54 | 55 | *hashes_done = n - first_nonce + 1; 56 | pdata[19] = n; 57 | return 0; 58 | } 59 | 60 | bool register_whirlpoolx_algo( algo_gate_t* gate ) 61 | { 62 | algo_not_tested(); 63 | gate->scanhash = (void*)&scanhash_whirlpoolx; 64 | gate->hash = (void*)&whirlpoolx_hash; 65 | return true; 66 | }; 67 | 68 | -------------------------------------------------------------------------------- /algo/x11/c11-gate.c: -------------------------------------------------------------------------------- 1 | #include "c11-gate.h" 2 | 3 | bool register_c11_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (C11_8WAY) 6 | gate->scanhash = (void*)&scanhash_c11_8way; 7 | gate->hash = (void*)&c11_8way_hash; 8 | #elif defined (C11_4WAY) 9 | gate->scanhash = (void*)&scanhash_c11_4way; 10 | gate->hash = (void*)&c11_4way_hash; 11 | #else 12 | init_c11_ctx(); 13 | gate->scanhash = (void*)&scanhash_c11; 14 | gate->hash = (void*)&c11_hash; 15 | #endif 16 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 17 | return true; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /algo/x11/c11-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef C11_GATE_H__ 2 | #define C11_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define C11_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define C11_4WAY 1 11 | #endif 12 | 13 | 14 | bool register_c11_algo( algo_gate_t* gate ); 15 | #if defined(C11_8WAY) 16 | 17 | int c11_8way_hash( void *state, const void *input, int thr_id ); 18 | int scanhash_c11_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | //void init_c11_8way_ctx(); 21 | 22 | #elif defined(C11_4WAY) 23 | 24 | int c11_4way_hash( void *state, const void *input, int thr_id ); 25 | int scanhash_c11_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_c11_4way_ctx(); 28 | 29 | #else 30 | 31 | void c11_hash( void *state, const void *input ); 32 | int scanhash_c11( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | void init_c11_ctx(); 35 | 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /algo/x11/timetravel-gate.c: -------------------------------------------------------------------------------- 1 | #include "timetravel-gate.h" 2 | 3 | bool register_timetravel_algo( algo_gate_t* gate ) 4 | { 5 | #ifdef TIMETRAVEL_4WAY 6 | init_tt8_4way_ctx(); 7 | gate->scanhash = (void*)&scanhash_timetravel_4way; 8 | gate->hash = (void*)&timetravel_4way_hash; 9 | #else 10 | init_tt8_ctx(); 11 | gate->scanhash = (void*)&scanhash_timetravel; 12 | gate->hash = (void*)&timetravel_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | opt_target_factor = 256.0; 16 | return true; 17 | }; 18 | 19 | static inline void tt_swap( int *a, int *b ) 20 | { 21 | int c = *a; 22 | *a = *b; 23 | *b = c; 24 | } 25 | 26 | static inline void reverse( int *pbegin, int *pend ) 27 | { 28 | while ( (pbegin != pend) && (pbegin != --pend) ) 29 | { 30 | tt_swap( pbegin, pend ); 31 | pbegin++; 32 | } 33 | } 34 | 35 | void tt8_next_permutation( int *pbegin, int *pend ) 36 | { 37 | if ( pbegin == pend ) 38 | return; 39 | 40 | int *i = pbegin; 41 | ++i; 42 | if ( i == pend ) 43 | return; 44 | 45 | i = pend; 46 | --i; 47 | 48 | while (1) 49 | { 50 | int *j = i; 51 | --i; 52 | 53 | if ( *i < *j ) 54 | { 55 | int *k = pend; 56 | 57 | while ( !(*i < *--k) ) /* do nothing */ ; 58 | 59 | tt_swap( i, k ); 60 | reverse(j, pend); 61 | return; // true 62 | } 63 | 64 | if ( i == pbegin ) 65 | { 66 | reverse(pbegin, pend); 67 | return; // false 68 | } 69 | // else? 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /algo/x11/timetravel-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMETRAVEL_GATE_H__ 2 | #define TIMETRAVEL_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define TIMETRAVEL_4WAY 9 | #endif 10 | 11 | // Machinecoin Genesis Timestamp 12 | #define TT8_FUNC_BASE_TIMESTAMP 1389040865 13 | 14 | #define TT8_FUNC_COUNT 8 15 | #define TT8_FUNC_COUNT_PERMUTATIONS 40320 16 | 17 | void tt8_next_permutation( int *pbegin, int *pend ); 18 | 19 | bool register_timetravel_algo( algo_gate_t* gate ); 20 | 21 | #if defined(TIMETRAVEL_4WAY) 22 | 23 | void timetravel_4way_hash( void *state, const void *input ); 24 | 25 | int scanhash_timetravel_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | 28 | void init_tt8_4way_ctx(); 29 | 30 | #endif 31 | 32 | void timetravel_hash( void *state, const void *input ); 33 | 34 | int scanhash_timetravel( struct work *work, uint32_t max_nonce, 35 | uint64_t *hashes_done, struct thr_info *mythr ); 36 | 37 | void init_tt8_ctx(); 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /algo/x11/timetravel10-gate.c: -------------------------------------------------------------------------------- 1 | #include "timetravel10-gate.h" 2 | 3 | bool register_timetravel10_algo( algo_gate_t* gate ) 4 | { 5 | #ifdef TIMETRAVEL10_4WAY 6 | init_tt10_4way_ctx(); 7 | gate->scanhash = (void*)&scanhash_timetravel10_4way; 8 | gate->hash = (void*)&timetravel10_4way_hash; 9 | #else 10 | init_tt10_ctx(); 11 | gate->scanhash = (void*)&scanhash_timetravel10; 12 | gate->hash = (void*)&timetravel10_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | opt_target_factor = 256.0; 16 | return true; 17 | }; 18 | 19 | static inline void tt10_swap( int *a, int *b ) 20 | { 21 | int c = *a; 22 | *a = *b; 23 | *b = c; 24 | } 25 | 26 | static inline void reverse( int *pbegin, int *pend ) 27 | { 28 | while ( (pbegin != pend) && (pbegin != --pend) ) 29 | { 30 | tt10_swap( pbegin, pend ); 31 | pbegin++; 32 | } 33 | } 34 | 35 | void tt10_next_permutation( int *pbegin, int *pend ) 36 | { 37 | if ( pbegin == pend ) 38 | return; 39 | 40 | int *i = pbegin; 41 | ++i; 42 | if ( i == pend ) 43 | return; 44 | 45 | i = pend; 46 | --i; 47 | 48 | while (1) 49 | { 50 | int *j = i; 51 | --i; 52 | 53 | if ( *i < *j ) 54 | { 55 | int *k = pend; 56 | 57 | while ( !(*i < *--k) ) /* do nothing */ ; 58 | 59 | tt10_swap( i, k ); 60 | reverse(j, pend); 61 | return; // true 62 | } 63 | 64 | if ( i == pbegin ) 65 | { 66 | reverse(pbegin, pend); 67 | return; // false 68 | } 69 | // else? 70 | } 71 | } 72 | 73 | -------------------------------------------------------------------------------- /algo/x11/timetravel10-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef TIMETRAVEL10_GATE_H__ 2 | #define TIMETRAVEL10_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define TIMETRAVEL10_4WAY 9 | #endif 10 | 11 | // BitCore Genesis Timestamp 12 | #define TT10_FUNC_BASE_TIMESTAMP 1492973331U 13 | #define TT10_FUNC_COUNT 10 14 | #define TT10_FUNC_COUNT_PERMUTATIONS 40320 15 | 16 | void tt10_next_permutation( int *pbegin, int *pend ); 17 | 18 | bool register_timetravel10_algo( algo_gate_t* gate ); 19 | 20 | #if defined(TIMETRAVEL10_4WAY) 21 | 22 | void timetravel10_4way_hash( void *state, const void *input ); 23 | 24 | int scanhash_timetravel10_4way( struct work *work, 25 | uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | void init_tt10_4way_ctx(); 28 | 29 | #endif 30 | 31 | void timetravel10_hash( void *state, const void *input ); 32 | 33 | int scanhash_timetravel10( struct work *work, uint32_t max_nonce, 34 | uint64_t *hashes_done, struct thr_info *mythr ); 35 | 36 | void init_tt10_ctx(); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /algo/x11/tribus-gate.c: -------------------------------------------------------------------------------- 1 | #include "tribus-gate.h" 2 | 3 | bool register_tribus_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 6 | #if defined (TRIBUS_8WAY) 7 | gate->scanhash = (void*)&scanhash_tribus_8way; 8 | gate->hash = (void*)&tribus_hash_8way; 9 | #elif defined (TRIBUS_4WAY) 10 | gate->scanhash = (void*)&scanhash_tribus_4way; 11 | gate->hash = (void*)&tribus_hash_4way; 12 | #else 13 | gate->miner_thread_init = (void*)&tribus_thread_init; 14 | gate->scanhash = (void*)&scanhash_tribus; 15 | gate->hash = (void*)&tribus_hash; 16 | #endif 17 | return true; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /algo/x11/tribus-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef TRIBUS_GATE_H__ 2 | #define TRIBUS_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define TRIBUS_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define TRIBUS_4WAY 1 11 | #endif 12 | 13 | #if defined(TRIBUS_8WAY) 14 | 15 | void tribus_hash_8way( void *state, const void *input ); 16 | 17 | int scanhash_tribus_8way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | 20 | #elif defined(TRIBUS_4WAY) 21 | 22 | void tribus_hash_4way( void *state, const void *input ); 23 | 24 | int scanhash_tribus_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | 27 | #else 28 | 29 | void tribus_hash( void *state, const void *input ); 30 | 31 | int scanhash_tribus( struct work *work, uint32_t max_nonce, 32 | uint64_t *hashes_done, struct thr_info *mythr ); 33 | 34 | bool tribus_thread_init(); 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /algo/x11/x11-gate.c: -------------------------------------------------------------------------------- 1 | #include "x11-gate.h" 2 | 3 | bool register_x11_algo( algo_gate_t *gate ) 4 | { 5 | #if defined (X11_8WAY) 6 | init_x11_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x11_8way; 8 | gate->hash = (void*)&x11_8way_hash; 9 | #elif defined (X11_4WAY) 10 | init_x11_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x11_4way; 12 | gate->hash = (void*)&x11_4way_hash; 13 | #else 14 | init_x11_ctx(); 15 | gate->scanhash = (void*)&scanhash_x11; 16 | gate->hash = (void*)&x11_hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT ; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x11/x11-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X11_GATE_H__ 2 | #define X11_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X11_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X11_4WAY 1 11 | #endif 12 | 13 | bool register_x11_algo( algo_gate_t* gate ); 14 | #if defined(X11_8WAY) 15 | 16 | void x11_8way_hash( void *state, const void *input ); 17 | int scanhash_x11_8way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | void init_x11_8way_ctx(); 20 | 21 | #elif defined(X11_4WAY) 22 | 23 | void x11_4way_hash( void *state, const void *input ); 24 | int scanhash_x11_4way( struct work *work, uint32_t max_nonce, 25 | uint64_t *hashes_done, struct thr_info *mythr ); 26 | void init_x11_4way_ctx(); 27 | 28 | #else 29 | 30 | void x11_hash( void *state, const void *input ); 31 | int scanhash_x11( struct work *work, uint32_t max_nonce, 32 | uint64_t *hashes_done, struct thr_info *mythr ); 33 | void init_x11_ctx(); 34 | 35 | #endif 36 | 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /algo/x11/x11evo-gate.c: -------------------------------------------------------------------------------- 1 | #include "x11evo-gate.h" 2 | 3 | int s_seq = -1; 4 | 5 | static inline int getCurrentAlgoSeq( uint32_t current_time ) 6 | { 7 | // change once per day 8 | return (int) (current_time - X11EVO_INITIAL_DATE) / (60 * 60 * 24); 9 | } 10 | 11 | // swap_vars doesn't work here 12 | void evo_swap( uint8_t *a, uint8_t *b ) 13 | { 14 | uint8_t __tmp = *a; 15 | *a = *b; 16 | *b = __tmp; 17 | } 18 | 19 | void initPerm( uint8_t n[], uint8_t count ) 20 | { 21 | int i; 22 | for ( i = 0; i0 && n[i - 1] >= n[i]; i-- ); 34 | tail = i; 35 | 36 | if ( tail > 0 ) 37 | { 38 | for ( j = count - 1; j>tail && n[j] <= n[tail - 1]; j-- ); 39 | evo_swap( &n[tail - 1], &n[j] ); 40 | } 41 | 42 | for ( i = tail, j = count - 1; i= 10 ) 63 | sprintf( sptr, "%c", 'A' + (algoList[j] - 10) ); 64 | else 65 | sprintf( sptr, "%u", algoList[j] ); 66 | sptr++; 67 | } 68 | *sptr = 0; 69 | 70 | //applog(LOG_DEBUG, "nextPerm %s", str); 71 | } 72 | 73 | void evo_twisted_code( uint32_t ntime, char *permstr ) 74 | { 75 | int seq = getCurrentAlgoSeq( ntime ); 76 | if ( s_seq != seq ) 77 | { 78 | getAlgoString( permstr, seq ); 79 | s_seq = seq; 80 | } 81 | } 82 | 83 | bool register_x11evo_algo( algo_gate_t* gate ) 84 | { 85 | #if defined (X11EVO_4WAY) 86 | init_x11evo_4way_ctx(); 87 | gate->scanhash = (void*)&scanhash_x11evo_4way; 88 | gate->hash = (void*)&x11evo_4way_hash; 89 | #else 90 | init_x11evo_ctx(); 91 | gate->scanhash = (void*)&scanhash_x11evo; 92 | gate->hash = (void*)&x11evo_hash; 93 | #endif 94 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 95 | return true; 96 | }; 97 | 98 | -------------------------------------------------------------------------------- /algo/x11/x11evo-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X11EVO_GATE_H__ 2 | #define X11EVO_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define X11EVO_4WAY 9 | #endif 10 | 11 | #define X11EVO_INITIAL_DATE 1462060800 12 | #define X11EVO_FUNC_COUNT 11 13 | 14 | extern int s_seq; 15 | 16 | bool register_x11evo_algo( algo_gate_t* gate ); 17 | 18 | #if defined(X11EVO_4WAY) 19 | 20 | void x11evo_4way_hash( void *state, const void *input ); 21 | 22 | int scanhash_x11evo_4way( struct work *work, uint32_t max_nonce, 23 | uint64_t *hashes_done, struct thr_info *mythr ); 24 | 25 | void init_x11evo_4way_ctx(); 26 | 27 | #endif 28 | 29 | void x11evo_hash( void *state, const void *input ); 30 | 31 | int scanhash_x11evo( struct work *work, uint32_t max_nonce, 32 | uint64_t *hashes_done, struct thr_info *mythr ); 33 | 34 | void init_x11evo_ctx(); 35 | 36 | void evo_twisted_code( uint32_t ntime, char *permstr ); 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /algo/x11/x11gost-gate.c: -------------------------------------------------------------------------------- 1 | #include "x11gost-gate.h" 2 | 3 | bool register_x11gost_algo( algo_gate_t* gate ) 4 | { 5 | #if defined(X11GOST_8WAY) 6 | init_x11gost_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x11gost_8way; 8 | gate->hash = (void*)&x11gost_8way_hash; 9 | #elif defined(X11GOST_4WAY) 10 | init_x11gost_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x11gost_4way; 12 | gate->hash = (void*)&x11gost_4way_hash; 13 | #elif defined(X11GOST_2WAY) 14 | gate->scanhash = (void*)&scanhash_x11gost_2x64; 15 | gate->hash = (void*)&x11gost_2x64_hash; 16 | #else 17 | init_x11gost_ctx(); 18 | gate->scanhash = (void*)&scanhash_x11gost; 19 | gate->hash = (void*)&x11gost_hash; 20 | #endif 21 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT 22 | | NEON_OPT; 23 | return true; 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /algo/x11/x11gost-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X11GOST_GATE_H__ 2 | #define X11GOST_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X11GOST_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X11GOST_4WAY 1 11 | #elif defined(__SSE2__) || defined(__ARM_NEON) 12 | #define X11GOST_2WAY 1 13 | #endif 14 | 15 | bool register_x11gost_algo( algo_gate_t* gate ); 16 | 17 | #if defined(X11GOST_8WAY) 18 | 19 | void x11gost_8way_hash( void *state, const void *input ); 20 | int scanhash_x11gost_8way( struct work *work, uint32_t max_nonce, 21 | uint64_t *hashes_done, struct thr_info *mythr ); 22 | void init_x11gost_8way_ctx(); 23 | 24 | #elif defined(X11GOST_4WAY) 25 | 26 | void x11gost_4way_hash( void *state, const void *input ); 27 | int scanhash_x11gost_4way( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | void init_x11gost_4way_ctx(); 30 | 31 | #elif defined(X11GOST_2WAY) 32 | 33 | int x11gost_2x64_hash( void *state, const void *input, int thr_id ); 34 | int scanhash_x11gost_2x64( struct work *work, uint32_t max_nonce, 35 | uint64_t *hashes_done, struct thr_info *mythr ); 36 | 37 | #else 38 | 39 | void x11gost_hash( void *state, const void *input ); 40 | int scanhash_x11gost( struct work *work, uint32_t max_nonce, 41 | uint64_t *hashes_done, struct thr_info *mythr ); 42 | void init_x11gost_ctx(); 43 | 44 | #endif 45 | 46 | #endif 47 | 48 | -------------------------------------------------------------------------------- /algo/x12/x12-gate.c: -------------------------------------------------------------------------------- 1 | #include "x12-gate.h" 2 | 3 | bool register_x12_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X12_8WAY) 6 | init_x12_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x12_8way; 8 | gate->hash = (void*)&x12_8way_hash; 9 | #elif defined (X12_4WAY) 10 | init_x12_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x12_4way; 12 | gate->hash = (void*)&x12_4way_hash; 13 | #else 14 | init_x12_ctx(); 15 | gate->scanhash = (void*)&scanhash_x12; 16 | gate->hash = (void*)&x12hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x12/x12-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X12_GATE_H__ 2 | #define X12_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X12_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X12_4WAY 1 11 | #endif 12 | 13 | bool register_x12_algo( algo_gate_t* gate ); 14 | 15 | #if defined(X12_8WAY) 16 | 17 | void x12_8way_hash( void *state, const void *input ); 18 | int scanhash_x12_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | void init_x12_8way_ctx(); 21 | 22 | #elif defined(X12_4WAY) 23 | 24 | void x12_4way_hash( void *state, const void *input ); 25 | int scanhash_x12_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_x12_4way_ctx(); 28 | 29 | #else 30 | 31 | void x12hash( void *state, const void *input ); 32 | int scanhash_x12( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | void init_x12_ctx(); 35 | 36 | #endif 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /algo/x13/phi1612-gate.c: -------------------------------------------------------------------------------- 1 | #include "phi1612-gate.h" 2 | 3 | bool register_phi1612_algo( algo_gate_t* gate ) 4 | { 5 | #if defined(PHI1612_8WAY) 6 | init_phi1612_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_phi1612_8way; 8 | gate->hash = (void*)&phi1612_8way_hash; 9 | #elif defined(PHI1612_4WAY) 10 | init_phi1612_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_phi1612_4way; 12 | gate->hash = (void*)&phi1612_4way_hash; 13 | #else 14 | init_phi1612_ctx(); 15 | gate->scanhash = (void*)&scanhash_phi1612; 16 | gate->hash = (void*)&phi1612_hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x13/phi1612-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef PHI1612_GATE_H__ 2 | #define PHI1612_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define PHI1612_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define PHI1612_4WAY 1 11 | #endif 12 | 13 | bool register_phi1612_algo( algo_gate_t* gate ); 14 | 15 | #if defined(PHI1612_8WAY) 16 | 17 | void phi1612_8way_hash( void *state, const void *input ); 18 | int scanhash_phi1612_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | void init_phi1612_8way_ctx(); 21 | 22 | #elif defined(PHI1612_4WAY) 23 | 24 | void phi1612_4way_hash( void *state, const void *input ); 25 | int scanhash_phi1612_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_phi1612_4way_ctx(); 28 | 29 | #else 30 | 31 | void phi1612_hash( void *state, const void *input ); 32 | int scanhash_phi1612( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | void init_phi1612_ctx(); 35 | 36 | #endif 37 | #endif 38 | 39 | -------------------------------------------------------------------------------- /algo/x13/skunk-gate.c: -------------------------------------------------------------------------------- 1 | #include "skunk-gate.h" 2 | 3 | bool register_skunk_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AVX2_OPT | AVX512_OPT | AES_OPT; 6 | #if defined (SKUNK_8WAY) 7 | gate->miner_thread_init = (void*)&skunk_8way_thread_init; 8 | gate->scanhash = (void*)&scanhash_skunk_8way; 9 | gate->hash = (void*)&skunk_8way_hash; 10 | #elif defined (SKUNK_4WAY) 11 | gate->miner_thread_init = (void*)&skunk_4way_thread_init; 12 | gate->scanhash = (void*)&scanhash_skunk_4way; 13 | gate->hash = (void*)&skunk_4way_hash; 14 | #else 15 | gate->miner_thread_init = (void*)&skunk_thread_init; 16 | gate->scanhash = (void*)&scanhash_skunk; 17 | gate->hash = (void*)&skunkhash; 18 | #endif 19 | return true; 20 | } 21 | 22 | -------------------------------------------------------------------------------- /algo/x13/skunk-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef SKUNK_GATE_H__ 2 | #define SKUNK_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define SKUNK_8WAY 1 9 | #elif defined(__AVX2__) 10 | #define SKUNK_4WAY 1 11 | #endif 12 | 13 | bool register_skunk_algo( algo_gate_t* gate ); 14 | 15 | #if defined(SKUNK_8WAY) 16 | 17 | void skunk_8way_hash( void *state, const void *input ); 18 | int scanhash_skunk_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | bool skunk_8way_thread_init(); 21 | 22 | #elif defined(SKUNK_4WAY) 23 | 24 | void skunk_4way_hash( void *state, const void *input ); 25 | int scanhash_skunk_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | bool skunk_4way_thread_init(); 28 | 29 | #endif 30 | 31 | void skunkhash( void *state, const void *input ); 32 | int scanhash_skunk( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | bool skunk_thread_init(); 35 | 36 | #endif 37 | 38 | -------------------------------------------------------------------------------- /algo/x13/x13-gate.c: -------------------------------------------------------------------------------- 1 | #include "x13-gate.h" 2 | 3 | bool register_x13_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X13_8WAY) 6 | init_x13_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x13_8way; 8 | gate->hash = (void*)&x13_8way_hash; 9 | #elif defined (X13_4WAY) 10 | init_x13_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x13_4way; 12 | gate->hash = (void*)&x13_4way_hash; 13 | #else 14 | init_x13_ctx(); 15 | gate->scanhash = (void*)&scanhash_x13; 16 | gate->hash = (void*)&x13hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x13/x13-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X13_GATE_H__ 2 | #define X13_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X13_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X13_4WAY 1 11 | #endif 12 | 13 | bool register_x13_algo( algo_gate_t* gate ); 14 | 15 | #if defined(X13_8WAY) 16 | 17 | void x13_8way_hash( void *state, const void *input ); 18 | int scanhash_x13_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | void init_x13_8way_ctx(); 21 | 22 | #elif defined(X13_4WAY) 23 | 24 | void x13_4way_hash( void *state, const void *input ); 25 | int scanhash_x13_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_x13_4way_ctx(); 28 | 29 | #else 30 | 31 | void x13hash( void *state, const void *input ); 32 | int scanhash_x13( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | void init_x13_ctx(); 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /algo/x13/x13sm3-gate.c: -------------------------------------------------------------------------------- 1 | #include "x13sm3-gate.h" 2 | 3 | bool register_x13sm3_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X13SM3_4WAY) 6 | init_x13sm3_4way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x13sm3_4way; 8 | gate->hash = (void*)&x13sm3_4way_hash; 9 | #else 10 | init_x13sm3_ctx(); 11 | gate->scanhash = (void*)&scanhash_x13sm3; 12 | gate->hash = (void*)&x13sm3_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | return true; 16 | }; 17 | 18 | bool register_x13bcd_algo( algo_gate_t* gate ) 19 | { 20 | #if defined (X13BCD_8WAY) 21 | init_x13bcd_8way_ctx(); 22 | gate->scanhash = (void*)&scanhash_x13bcd_8way; 23 | gate->hash = (void*)&x13bcd_8way_hash; 24 | #elif defined (X13BCD_4WAY) 25 | init_x13bcd_4way_ctx(); 26 | gate->scanhash = (void*)&scanhash_x13bcd_4way; 27 | gate->hash = (void*)&x13bcd_4way_hash; 28 | #else 29 | init_x13bcd_ctx(); 30 | gate->scanhash = (void*)&scanhash_x13bcd; 31 | gate->hash = (void*)&x13bcd_hash; 32 | #endif 33 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 34 | return true; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /algo/x13/x13sm3-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X13SM3_GATE_H__ 2 | #define X13SM3_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define X13SM3_4WAY 1 9 | #endif 10 | 11 | bool register_x13sm3_algo( algo_gate_t* gate ); 12 | 13 | #if defined(X13SM3_4WAY) 14 | 15 | void x13sm3_4way_hash( void *state, const void *input ); 16 | int scanhash_x13sm3_4way( struct work *work, uint32_t max_nonce, 17 | uint64_t *hashes_done, struct thr_info *mythr ); 18 | void init_x13sm3_4way_ctx(); 19 | 20 | #else 21 | 22 | void x13sm3_hash( void *state, const void *input ); 23 | int scanhash_x13sm3( struct work *work, uint32_t max_nonce, 24 | uint64_t *hashes_done, struct thr_info *mythr ); 25 | void init_x13sm3_ctx(); 26 | 27 | #endif 28 | 29 | #if defined(SIMD512) 30 | #define X13BCD_8WAY 1 31 | #elif defined(__AVX2__) && defined(__AES__) 32 | #define X13BCD_4WAY 1 33 | #endif 34 | 35 | bool register_x13bcd_algo( algo_gate_t* gate ); 36 | 37 | #if defined(X13BCD_8WAY) 38 | 39 | void x13bcd_8way_hash( void *state, const void *input ); 40 | int scanhash_x13bcd_8way( struct work *work, uint32_t max_nonce, 41 | uint64_t *hashes_done, struct thr_info *mythr ); 42 | void init_x13bcd_8way_ctx(); 43 | 44 | #elif defined(X13BCD_4WAY) 45 | 46 | void x13bcd_4way_hash( void *state, const void *input ); 47 | int scanhash_x13bcd_4way( struct work *work, uint32_t max_nonce, 48 | uint64_t *hashes_done, struct thr_info *mythr ); 49 | void init_x13bcd_4way_ctx(); 50 | 51 | #else 52 | 53 | void x13bcd_hash( void *state, const void *input ); 54 | int scanhash_x13bcd( struct work *work, uint32_t max_nonce, 55 | uint64_t *hashes_done, struct thr_info *mythr ); 56 | void init_x13bcd_ctx(); 57 | 58 | #endif 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /algo/x14/axiom.c: -------------------------------------------------------------------------------- 1 | #include "algo-gate-api.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "algo/shabal/sph_shabal.h" 7 | 8 | static __thread uint32_t _ALIGN(64) M[65536][8]; 9 | 10 | void axiomhash(void *output, const void *input) 11 | { 12 | sph_shabal256_context ctx __attribute__ ((aligned (64))); 13 | const int N = 65536; 14 | 15 | sph_shabal256_init(&ctx); 16 | sph_shabal256(&ctx, input, 80); 17 | sph_shabal256_close(&ctx, M[0]); 18 | 19 | for(int i = 1; i < N; i++) { 20 | sph_shabal256_init(&ctx); 21 | sph_shabal256(&ctx, M[i-1], 32); 22 | sph_shabal256_close(&ctx, M[i]); 23 | } 24 | 25 | for(int b = 0; b < N; b++) 26 | { 27 | const int p = b > 0 ? b - 1 : 0xFFFF; 28 | const int q = M[p][0] % 0xFFFF; 29 | const int j = (b + q) % N; 30 | 31 | sph_shabal256_init(&ctx); 32 | #if 0 33 | sph_shabal256(&ctx, M[p], 32); 34 | sph_shabal256(&ctx, M[j], 32); 35 | #else 36 | uint8_t _ALIGN(64) hash[64]; 37 | memcpy(hash, M[p], 32); 38 | memcpy(&hash[32], M[j], 32); 39 | sph_shabal256(&ctx, hash, 64); 40 | #endif 41 | sph_shabal256_close(&ctx, M[b]); 42 | } 43 | memcpy(output, M[N-1], 32); 44 | } 45 | 46 | int scanhash_axiom( struct work *work, 47 | uint32_t max_nonce, uint64_t *hashes_done, struct thr_info *mythr ) 48 | { 49 | uint32_t *pdata = work->data; 50 | uint32_t *ptarget = work->target; 51 | uint32_t _ALIGN(64) hash64[8]; 52 | uint32_t _ALIGN(64) endiandata[20]; 53 | int thr_id = mythr->id; // thr_id arg is deprecated 54 | 55 | const uint32_t Htarg = ptarget[7]; 56 | const uint32_t first_nonce = pdata[19]; 57 | 58 | uint32_t n = first_nonce; 59 | 60 | for (int k = 0; k < 19; k++) 61 | be32enc(&endiandata[k], pdata[k]); 62 | 63 | do { 64 | be32enc(&endiandata[19], n); 65 | axiomhash(hash64, endiandata); 66 | if (hash64[7] < Htarg && fulltest(hash64, ptarget)) 67 | { 68 | pdata[19] = n; 69 | submit_solution( work, hash64, mythr ); 70 | } 71 | n++; 72 | 73 | } while (n < max_nonce && !work_restart[thr_id].restart); 74 | 75 | *hashes_done = n - first_nonce + 1; 76 | pdata[19] = n; 77 | 78 | return 0; 79 | } 80 | 81 | bool register_axiom_algo( algo_gate_t* gate ) 82 | { 83 | gate->scanhash = (void*)&scanhash_axiom; 84 | gate->hash = (void*)&axiomhash; 85 | return true; 86 | } 87 | -------------------------------------------------------------------------------- /algo/x14/polytimos-gate.c: -------------------------------------------------------------------------------- 1 | #include "polytimos-gate.h" 2 | 3 | bool register_polytimos_algo( algo_gate_t* gate ) 4 | { 5 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 6 | #ifdef POLYTIMOS_4WAY 7 | gate->scanhash = (void*)&scanhash_polytimos_4way; 8 | gate->hash = (void*)&polytimos_4way_hash; 9 | #else 10 | init_polytimos_ctx(); 11 | gate->scanhash = (void*)&scanhash_polytimos; 12 | gate->hash = (void*)&polytimos_hash; 13 | #endif 14 | return true; 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /algo/x14/polytimos-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef POLYTIMOS_GATE_H__ 2 | #define POLYTIMOS_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define POLYTIMOS_4WAY 9 | #endif 10 | 11 | bool register_polytimos_algo( algo_gate_t* gate ); 12 | 13 | #if defined(POLYTIMOS_4WAY) 14 | 15 | void polytimos_4way_hash( void *state, const void *input ); 16 | int scanhash_polytimos_4way( struct work *work, uint32_t max_nonce, 17 | uint64_t *hashes_done, struct thr_info *mythr ); 18 | 19 | #endif 20 | 21 | void polytimos_hash( void *state, const void *input ); 22 | int scanhash_polytimos( struct work *work, uint32_t max_nonce, 23 | uint64_t *hashes_done, struct thr_info *mythr ); 24 | void init_polytimos_ctx(); 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /algo/x14/veltor-gate.c: -------------------------------------------------------------------------------- 1 | #include "veltor-gate.h" 2 | 3 | bool register_veltor_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (VELTOR_4WAY) 6 | init_veltor_4way_ctx(); 7 | gate->scanhash = (void*)&scanhash_veltor_4way; 8 | gate->hash = (void*)&veltor_4way_hash; 9 | #else 10 | init_veltor_ctx(); 11 | gate->scanhash = (void*)&scanhash_veltor; 12 | gate->hash = (void*)&veltor_hash; 13 | #endif 14 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT; 15 | return true; 16 | }; 17 | 18 | -------------------------------------------------------------------------------- /algo/x14/veltor-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef VELTOR_GATE_H__ 2 | #define VELTOR_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(__AVX2__) && defined(__AES__) 8 | #define VELTOR_4WAY 9 | #endif 10 | 11 | bool register_veltor_algo( algo_gate_t* gate ); 12 | 13 | #if defined(VELTOR_4WAY) 14 | 15 | void veltor_4way_hash( void *state, const void *input ); 16 | 17 | int scanhash_veltor_4way( struct work *work, uint32_t max_nonce, 18 | uint64_t *hashes_done, struct thr_info *mythr ); 19 | 20 | void init_veltor_4way_ctx(); 21 | 22 | #endif 23 | 24 | void veltor_hash( void *state, const void *input ); 25 | 26 | int scanhash_veltor( struct work *work, uint32_t max_nonce, 27 | uint64_t *hashes_done, struct thr_info *mythr ); 28 | 29 | void init_veltor_ctx(); 30 | 31 | #endif 32 | 33 | -------------------------------------------------------------------------------- /algo/x14/x14-gate.c: -------------------------------------------------------------------------------- 1 | #include "x14-gate.h" 2 | 3 | bool register_x14_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X14_8WAY) 6 | init_x14_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x14_8way; 8 | gate->hash = (void*)&x14_8way_hash; 9 | #elif defined (X14_4WAY) 10 | init_x14_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x14_4way; 12 | gate->hash = (void*)&x14_4way_hash; 13 | #else 14 | init_x14_ctx(); 15 | gate->scanhash = (void*)&scanhash_x14; 16 | gate->hash = (void*)&x14hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x14/x14-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X14_GATE_H__ 2 | #define X14_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X14_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X14_4WAY 1 11 | #endif 12 | 13 | bool register_x14_algo( algo_gate_t* gate ); 14 | 15 | #if defined(X14_8WAY) 16 | 17 | void x14_8way_hash( void *state, const void *input ); 18 | int scanhash_x14_8way( struct work *work, uint32_t max_nonce, 19 | uint64_t *hashes_done, struct thr_info *mythr ); 20 | void init_x14_8way_ctx(); 21 | 22 | #elif defined(X14_4WAY) 23 | 24 | void x14_4way_hash( void *state, const void *input ); 25 | int scanhash_x14_4way( struct work *work, uint32_t max_nonce, 26 | uint64_t *hashes_done, struct thr_info *mythr ); 27 | void init_x14_4way_ctx(); 28 | 29 | #else 30 | 31 | void x14hash( void *state, const void *input ); 32 | int scanhash_x14( struct work *work, uint32_t max_nonce, 33 | uint64_t *hashes_done, struct thr_info *mythr ); 34 | void init_x14_ctx(); 35 | 36 | #endif 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /algo/x15/x15-gate.c: -------------------------------------------------------------------------------- 1 | #include "x15-gate.h" 2 | 3 | bool register_x15_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X15_8WAY) 6 | init_x15_8way_ctx(); 7 | gate->scanhash = (void*)&scanhash_x15_8way; 8 | gate->hash = (void*)&x15_8way_hash; 9 | #elif defined (X15_4WAY) 10 | init_x15_4way_ctx(); 11 | gate->scanhash = (void*)&scanhash_x15_4way; 12 | gate->hash = (void*)&x15_4way_hash; 13 | #else 14 | init_x15_ctx(); 15 | gate->scanhash = (void*)&scanhash_x15; 16 | gate->hash = (void*)&x15hash; 17 | #endif 18 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 19 | return true; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /algo/x15/x15-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X15_GATE_H__ 2 | #define X15_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X15_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define X15_4WAY 1 11 | #endif 12 | 13 | 14 | bool register_x15_algo( algo_gate_t* gate ); 15 | 16 | #if defined(X15_8WAY) 17 | 18 | void x15_8way_hash( void *state, const void *input ); 19 | int scanhash_x15_8way( struct work *work, uint32_t max_nonce, 20 | uint64_t *hashes_done, struct thr_info *mythr ); 21 | void init_x15_8way_ctx(); 22 | 23 | #elif defined(X15_4WAY) 24 | 25 | void x15_4way_hash( void *state, const void *input ); 26 | int scanhash_x15_4way( struct work *work, uint32_t max_nonce, 27 | uint64_t *hashes_done, struct thr_info *mythr ); 28 | void init_x15_4way_ctx(); 29 | 30 | #else 31 | 32 | void x15hash( void *state, const void *input ); 33 | int scanhash_x15( struct work *work, uint32_t max_nonce, 34 | uint64_t *hashes_done, struct thr_info *mythr ); 35 | void init_x15_ctx(); 36 | 37 | #endif 38 | 39 | #endif 40 | 41 | -------------------------------------------------------------------------------- /algo/x16/x16rt.c: -------------------------------------------------------------------------------- 1 | #include "x16r-gate.h" 2 | 3 | #if !defined(X16RT_8WAY) && !defined(X16RT_4WAY) 4 | 5 | int scanhash_x16rt( struct work *work, uint32_t max_nonce, 6 | uint64_t *hashes_done, struct thr_info *mythr ) 7 | { 8 | uint32_t _ALIGN(128) hash32[8]; 9 | uint32_t _ALIGN(128) edata[20]; 10 | uint32_t _ALIGN(64) timeHash[8]; 11 | uint32_t *pdata = work->data; 12 | uint32_t *ptarget = work->target; 13 | const uint32_t first_nonce = pdata[19]; 14 | const int thr_id = mythr->id; 15 | uint32_t nonce = first_nonce; 16 | volatile uint8_t *restart = &(work_restart[thr_id].restart); 17 | const bool bench = opt_benchmark; 18 | if ( bench ) ptarget[7] = 0x0cff; 19 | 20 | v128_bswap32_80( edata, pdata ); 21 | 22 | static __thread uint32_t s_ntime = UINT32_MAX; 23 | uint32_t masked_ntime = swab32( pdata[17] ) & 0xffffff80; 24 | if ( s_ntime != masked_ntime ) 25 | { 26 | x16rt_getTimeHash( masked_ntime, &timeHash ); 27 | x16rt_getAlgoString( &timeHash[0], x16r_hash_order ); 28 | s_ntime = masked_ntime; 29 | if ( !thr_id ) 30 | applog( LOG_INFO, "hash order: %s time: (%08x) time hash: (%08x)", 31 | x16r_hash_order, swab32( pdata[17] ), timeHash ); 32 | } 33 | 34 | x16r_prehash( edata, pdata, x16r_hash_order ); 35 | 36 | do 37 | { 38 | edata[19] = nonce; 39 | if ( x16r_hash( hash32, edata, thr_id ) ) 40 | if ( valid_hash( hash32, ptarget ) && !bench ) 41 | { 42 | pdata[19] = bswap_32( nonce ); 43 | submit_solution( work, hash32, mythr ); 44 | } 45 | nonce++; 46 | } while ( nonce < max_nonce && !(*restart) ); 47 | pdata[19] = nonce; 48 | *hashes_done = pdata[19] - first_nonce; 49 | return 0; 50 | } 51 | 52 | #endif // !defined(X16R_8WAY) && !defined(X16R_4WAY) 53 | 54 | -------------------------------------------------------------------------------- /algo/x17/sonoa-gate.c: -------------------------------------------------------------------------------- 1 | #include "sonoa-gate.h" 2 | 3 | bool register_sonoa_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (SONOA_8WAY) 6 | gate->scanhash = (void*)&scanhash_8way_64in_32out; 7 | gate->hash = (void*)&sonoa_8way_hash; 8 | #elif defined (SONOA_4WAY) 9 | gate->scanhash = (void*)&scanhash_4way_64in_32out; 10 | gate->hash = (void*)&sonoa_4way_hash; 11 | #else 12 | init_sonoa_ctx(); 13 | gate->hash = (void*)&sonoa_hash; 14 | #endif 15 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 16 | return true; 17 | }; 18 | 19 | -------------------------------------------------------------------------------- /algo/x17/sonoa-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef SONOA_GATE_H__ 2 | #define SONOA_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define SONOA_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define SONOA_4WAY 1 11 | #endif 12 | 13 | bool register_sonoa_algo( algo_gate_t* gate ); 14 | 15 | #if defined(SONOA_8WAY) 16 | 17 | int sonoa_8way_hash( void *state, const void *input, int thr_id ); 18 | 19 | #elif defined(SONOA_4WAY) 20 | 21 | int sonoa_4way_hash( void *state, const void *input, int thr_id ); 22 | 23 | #else 24 | 25 | int sonoa_hash( void *state, const void *input, int thr_id ); 26 | void init_sonoa_ctx(); 27 | 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /algo/x17/x17-gate.c: -------------------------------------------------------------------------------- 1 | #include "x17-gate.h" 2 | 3 | bool register_x17_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (X17_16X32) 6 | gate->scanhash = (void*)&scanhash_x17_16x32; 7 | gate->hash = (void*)&x17_16way_hash; 8 | #elif defined (X17_8WAY) 9 | gate->scanhash = (void*)&scanhash_x17_8x64; 10 | gate->hash = (void*)&x17_8x64_hash; 11 | #elif defined (X17_4WAY) 12 | gate->scanhash = (void*)&scanhash_x17_4x64; 13 | gate->hash = (void*)&x17_4x64_hash; 14 | #elif defined (X17_2X64) 15 | gate->scanhash = (void*)&scanhash_x17_2x64; 16 | gate->hash = (void*)&x17_2x64_hash; 17 | #else 18 | gate->hash = (void*)&x17_hash; 19 | #endif 20 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT 21 | | NEON_OPT; 22 | return true; 23 | }; 24 | 25 | -------------------------------------------------------------------------------- /algo/x17/x17-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X17_GATE_H__ 2 | #define X17_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define X17_8WAY 1 9 | // #define X17_16X32 1 10 | #elif defined(__AVX2__) && defined(__AES__) 11 | #define X17_4WAY 1 12 | #define X17_8X32 1 13 | #elif defined(__SSE2__) || defined(__ARM_NEON) 14 | #define X17_2X64 1 15 | #endif 16 | 17 | bool register_x17_algo( algo_gate_t* gate ); 18 | 19 | #if defined(X17_8WAY) || defined(X17_16X32) 20 | 21 | int scanhash_x17_16x32( struct work *work, uint32_t max_nonce, 22 | uint64_t *hashes_done, struct thr_info *mythr ); 23 | #define scanhash_x17_16way scanhash_x17_16x32 24 | 25 | //int x17_16way_hash( void *state, const void *input, int thr_id ); 26 | 27 | int scanhash_x17_8x64( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | #define scanhash_x17_8way scanhash_x17_8x64 30 | 31 | int x17_8x64_hash( void *state, const void *input, int thr_id ); 32 | #define x17_8way_hash x17_8x64_hash 33 | 34 | #elif defined(X17_4WAY) 35 | 36 | int scanhash_x17_4x64( struct work *work, uint32_t max_nonce, 37 | uint64_t *hashes_done, struct thr_info *mythr ); 38 | #define scanhash_x17_4way scanhash_x17_4x64 39 | 40 | int x17_4x64_hash( void *state, const void *input, int thr_id ); 41 | #define x17_4way_hash x17_4x64_hash 42 | 43 | #elif defined(X17_2X64) 44 | 45 | int scanhash_x17_2x64( struct work *work, uint32_t max_nonce, 46 | uint64_t *hashes_done, struct thr_info *mythr ); 47 | 48 | int x17_2x64_hash( void *state, const void *input, int thr_id ); 49 | 50 | #endif 51 | 52 | int x17_hash( void *state, const void *input, int thr_id ); 53 | 54 | #endif 55 | 56 | -------------------------------------------------------------------------------- /algo/x17/xevan-gate.c: -------------------------------------------------------------------------------- 1 | #include "xevan-gate.h" 2 | 3 | bool register_xevan_algo( algo_gate_t* gate ) 4 | { 5 | #if defined (XEVAN_8WAY) 6 | gate->scanhash = (void*)&scanhash_8way_64in_32out; 7 | gate->hash = (void*)&xevan_8way_hash; 8 | #elif defined (XEVAN_4WAY) 9 | gate->scanhash = (void*)&scanhash_4way_64in_32out; 10 | gate->hash = (void*)&xevan_4way_hash; 11 | #else 12 | init_xevan_ctx(); 13 | gate->hash = (void*)&xevan_hash; 14 | #endif 15 | gate->optimizations = SSE2_OPT | AES_OPT | AVX2_OPT | AVX512_OPT | VAES_OPT; 16 | opt_target_factor = 256.0; 17 | return true; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /algo/x17/xevan-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef XEVAN_GATE_H__ 2 | #define XEVAN_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include 6 | 7 | #if defined(SIMD512) 8 | #define XEVAN_8WAY 1 9 | #elif defined(__AVX2__) && defined(__AES__) 10 | #define XEVAN_4WAY 1 11 | #endif 12 | 13 | bool register_xevan_algo( algo_gate_t* gate ); 14 | 15 | #if defined(XEVAN_8WAY) 16 | 17 | int xevan_8way_hash( void *state, const void *input, int thr_id ); 18 | 19 | #elif defined(XEVAN_4WAY) 20 | 21 | int xevan_4way_hash( void *state, const void *input, int thr_id ); 22 | 23 | #else 24 | 25 | int xevan_hash( void *state, const void *input, int trh_id ); 26 | void init_xevan_ctx(); 27 | 28 | #endif 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /algo/x22/x22i-gate.c: -------------------------------------------------------------------------------- 1 | #include "x22i-gate.h" 2 | 3 | // Ryzen has poor AVX2 performance so use SHA over AVX2. 4 | // Intel has AVX512 so use AVX512 over SHA. 5 | // When Ryzen AVX2 improves use AVX2 over SHA. 6 | 7 | bool register_x22i_algo( algo_gate_t* gate ) 8 | { 9 | #if defined (X22I_8WAY) 10 | 11 | #if defined(X22I_8WAY_SHA) 12 | gate->scanhash = (void*)&scanhash_x22i_8way_sha; 13 | #else 14 | gate->scanhash = (void*)&scanhash_x22i_8way; 15 | #endif 16 | gate->hash = (void*)&x22i_8way_hash; 17 | 18 | #elif defined (X22I_4WAY) 19 | 20 | #if defined(X22I_4WAY_SHA) 21 | gate->scanhash = (void*)&scanhash_x22i_4way_sha; 22 | #else 23 | gate->scanhash = (void*)&scanhash_x22i_4way; 24 | #endif 25 | gate->hash = (void*)&x22i_4way_hash; 26 | 27 | #else 28 | 29 | gate->scanhash = (void*)&scanhash_x22i; 30 | gate->hash = (void*)&x22i_hash; 31 | 32 | #endif 33 | 34 | gate->optimizations = SSE2_OPT | SSE42_OPT | AES_OPT | AVX2_OPT | SHA256_OPT 35 | | AVX512_OPT | VAES_OPT | NEON_OPT; 36 | return true; 37 | }; 38 | 39 | bool register_x25x_algo( algo_gate_t* gate ) 40 | { 41 | #if defined (X25X_8WAY) 42 | gate->scanhash = (void*)&scanhash_x25x_8way; 43 | gate->hash = (void*)&x25x_8way_hash; 44 | #elif defined (X25X_4WAY) 45 | gate->scanhash = (void*)&scanhash_x25x_4way; 46 | gate->hash = (void*)&x25x_4way_hash; 47 | #else 48 | gate->scanhash = (void*)&scanhash_x25x; 49 | gate->hash = (void*)&x25x_hash; 50 | #endif 51 | gate->optimizations = SSE2_OPT | SSE42_OPT | AES_OPT | AVX2_OPT | SHA256_OPT | 52 | AVX512_OPT | VAES_OPT | NEON_OPT; 53 | InitializeSWIFFTX(); 54 | return true; 55 | }; 56 | 57 | -------------------------------------------------------------------------------- /algo/x22/x22i-gate.h: -------------------------------------------------------------------------------- 1 | #ifndef X22I_GATE_H__ 2 | #define X22I_GATE_H__ 1 3 | 4 | #include "algo-gate-api.h" 5 | #include "simd-utils.h" 6 | #include 7 | #include 8 | #include "algo/swifftx/swifftx.h" 9 | 10 | #if defined(SIMD512) 11 | #define X22I_8WAY 1 12 | #elif defined(__AVX2__) && defined(__AES__) 13 | #define X22I_4WAY 1 14 | #endif 15 | 16 | #if defined(__SHA__) 17 | // #define X22I_8WAY_SHA 1 18 | #define X22I_4WAY_SHA 1 19 | #endif 20 | 21 | bool register_x22i_algo( algo_gate_t* gate ); 22 | 23 | #if defined(X22I_8WAY) 24 | 25 | int x22i_8way_hash( void *state, const void *input, int thrid ); 26 | #if defined(X22I_8WAY_SHA) 27 | int scanhash_x22i_8way_sha( struct work *work, uint32_t max_nonce, 28 | uint64_t *hashes_done, struct thr_info *mythr ); 29 | #else 30 | int scanhash_x22i_8way( struct work *work, uint32_t max_nonce, 31 | uint64_t *hashes_done, struct thr_info *mythr ); 32 | #endif 33 | 34 | #elif defined(X22I_4WAY) 35 | 36 | int x22i_4way_hash( void *state, const void *input, int thrid ); 37 | #if defined(X22I_4WAY_SHA) 38 | int scanhash_x22i_4way_sha( struct work *work, uint32_t max_nonce, 39 | uint64_t *hashes_done, struct thr_info *mythr ); 40 | #else 41 | int scanhash_x22i_4way( struct work *work, uint32_t max_nonce, 42 | uint64_t *hashes_done, struct thr_info *mythr ); 43 | #endif 44 | 45 | #else 46 | 47 | int x22i_hash( void *state, const void *input, int thrid ); 48 | int scanhash_x22i( struct work *work, uint32_t max_nonce, 49 | uint64_t *hashes_done, struct thr_info *mythr ); 50 | 51 | #endif 52 | 53 | #if defined(SIMD512) 54 | #define X25X_8WAY 1 55 | #elif defined(__AVX2__) && defined(__AES__) 56 | #define X25X_4WAY 1 57 | #endif 58 | 59 | #if defined(__SHA__) 60 | // #define X25X_8WAY_SHA 1 61 | #define X25X_4WAY_SHA 1 62 | #endif 63 | 64 | bool register_x25i_algo( algo_gate_t* gate ); 65 | 66 | #if defined(X25X_8WAY) 67 | 68 | int x25x_8way_hash( void *state, const void *input, int thrid ); 69 | int scanhash_x25x_8way( struct work *work, uint32_t max_nonce, 70 | uint64_t *hashes_done, struct thr_info *mythr ); 71 | 72 | #elif defined(X25X_4WAY) 73 | 74 | int x25x_4way_hash( void *state, const void *input, int thrid ); 75 | int scanhash_x25x_4way( struct work *work, uint32_t max_nonce, 76 | uint64_t *hashes_done, struct thr_info *mythr ); 77 | 78 | #else 79 | 80 | int x25x_hash( void *state, const void *input, int thrif ); 81 | int scanhash_x25x( struct work *work, uint32_t max_nonce, 82 | uint64_t *hashes_done, struct thr_info *mythr ); 83 | 84 | #endif 85 | 86 | #endif // X22I_GATE_H__ 87 | -------------------------------------------------------------------------------- /algo/yespower/TESTS-OK: -------------------------------------------------------------------------------- 1 | yespower(5, 2048, 8, "Client Key") = a5 9f ec 4c 4f dd a1 6e 3b 14 05 ad da 66 d5 25 b6 8e 7c ad fc fe 6a c0 66 c7 ad 11 8c d8 05 90 2 | yespower(5, 2048, 8, BSTY) = 5e a2 b2 95 6a 9e ac e3 0a 32 37 ff 1d 44 1e de e1 dc 25 aa b8 f0 ea 15 c1 21 65 f8 3a 7b c2 65 3 | yespower(5, 4096, 16, "Client Key") = 92 7e 72 d0 de d3 d8 04 75 47 3f 40 f1 74 3c 67 28 9d 45 3d 52 42 d4 f5 5a f4 e3 25 e0 66 99 c5 4 | yespower(5, 4096, 24, "Jagaricoin") = 0e 13 66 97 32 11 e7 fe a8 ad 9d 81 98 9c 84 a2 54 d9 68 c9 d3 33 dd 8f f0 99 32 4f 38 61 1e 04 5 | yespower(5, 4096, 32, "WaviBanana") = 3a e0 5a bb 3c 5c f6 f7 54 15 a9 25 54 c9 8d 50 e3 8e c9 55 2c fa 78 37 36 16 f4 80 b2 4e 55 9f 6 | yespower(5, 2048, 32, "Client Key") = 56 0a 89 1b 5c a2 e1 c6 36 11 1a 9f f7 c8 94 a5 d0 a2 60 2f 43 fd cf a5 94 9b 95 e2 2f e4 46 1e 7 | yespower(5, 1024, 32, "Client Key") = 2a 79 e5 3d 1b e6 66 9b c5 56 cc c4 17 bc e3 d2 2a 74 a2 32 f5 6b 8e 1d 39 b4 57 92 67 5d e1 08 8 | yespower(5, 2048, 8, NULL) = 5e cb d8 e8 d7 c9 0b ae d4 bb f8 91 6a 12 25 dc c3 c6 5f 5c 91 65 ba e8 1c dd e3 cf fa d1 28 e8 9 | yespower(10, 2048, 8, NULL) = 69 e0 e8 95 b3 df 7a ee b8 37 d7 1f e1 99 e9 d3 4f 7e c4 6e cb ca 7a 2c 43 08 e5 18 57 ae 9b 46 10 | yespower(10, 4096, 16, NULL) = 33 fb 8f 06 38 24 a4 a0 20 f6 3d ca 53 5f 5c a6 6a b5 57 64 68 c7 5d 1c ca ac 75 42 f7 64 95 ac 11 | yespower(10, 4096, 32, NULL) = 77 1a ee fd a8 fe 79 a0 82 5b c7 f2 ae e1 62 ab 55 78 57 46 39 ff c6 ca 37 23 cc 18 e5 e3 e2 85 12 | yespower(10, 2048, 32, NULL) = d5 ef b8 13 cd 26 3e 9b 34 54 01 30 23 3c bb c6 a9 21 fb ff 34 31 e5 ec 1a 1a bd e2 ae a6 ff 4d 13 | yespower(10, 1024, 32, NULL) = 50 1b 79 2d b4 2e 38 8f 6e 7d 45 3c 95 d0 3a 12 a3 60 16 a5 15 4a 68 83 90 dd c6 09 a4 0c 67 99 14 | yespower(10, 1024, 32, "personality test") = 1f 02 69 ac f5 65 c4 9a dc 0e f9 b8 f2 6a b3 80 8c dc 38 39 4a 25 4f dd ee dc c3 aa cf f6 ad 9d 15 | XOR of yespower(5, ...) = 44 6c 17 2d fd 2b 39 64 d9 34 08 a3 bf 55 9e c7 42 31 7a 2c f2 b2 48 7c ec 41 17 e8 3d 7d 96 b0 16 | XOR of yespower(10, ...) = a9 fe c9 66 53 bd 25 ea 18 24 f3 f9 cc 96 c5 98 5f 19 1d 1d ca ee d3 e9 d0 52 f8 ac 76 bc bb da 17 | -------------------------------------------------------------------------------- /algo/yespower/crypto/hmac-blake2b.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef __HMAC_BLAKE2B_H__ 3 | #define __HMAC_BLAKE2B_H__ 4 | 5 | #include 6 | #include 7 | #include "algo/blake/sph_blake2b.h" 8 | 9 | #if defined(_MSC_VER) || defined(__x86_64__) || defined(__x86__) 10 | #define NATIVE_LITTLE_ENDIAN 11 | #endif 12 | 13 | typedef struct 14 | { 15 | sph_blake2b_ctx inner; 16 | sph_blake2b_ctx outer; 17 | } hmac_blake2b_ctx; 18 | 19 | #if defined(__cplusplus) 20 | extern "C" { 21 | #endif 22 | 23 | void hmac_blake2b_hash( void *out, const void *key, size_t keylen, 24 | const void *in, size_t inlen ); 25 | 26 | void pbkdf2_blake2b( const uint8_t * passwd, size_t passwdlen, 27 | const uint8_t * salt, size_t saltlen, uint64_t c, 28 | uint8_t * buf, size_t dkLen ); 29 | 30 | #if defined(__cplusplus) 31 | } 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /algo/yespower/yescrypt-r8g.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright 2009 Colin Percival 3 | * Copyright 2013-2018 Alexander Peslyak 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 | * SUCH DAMAGE. 26 | * 27 | * This file was originally written by Colin Percival as part of the Tarsnap 28 | * online backup system. 29 | */ 30 | #ifndef _YESPOWERR8G_H_ 31 | #define _YESPOWERR8G_H_ 32 | 33 | #include 34 | #include /* for size_t */ 35 | #include "algo-gate-api.h" 36 | #include "algo/yespower/yespower.h" 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | extern int yespowerr8g_tls(const uint8_t *src, size_t srclen, 43 | const yespower_params_t *params, yespower_binary_t *dst); 44 | 45 | #ifdef __cplusplus 46 | } 47 | #endif 48 | 49 | #endif /* !_YESPOWERR8G_H_ */ 50 | -------------------------------------------------------------------------------- /api/websocket.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Simple WebSocket call sample 6 | 7 | 8 |
9 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /armbuild-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script is not intended for users, it is only used for compile testing 4 | # during develpment. However the information contained may provide compilation 5 | # tips to users. 6 | 7 | rm cpuminer cpuminer-armv9-crypto-sha3 cpuminer-armv9-crypto cpuminer-armv9 cpuminer-armv8.5-crypto-sha3-sve2 cpuminer-armv8.4-crypto-sha3 cpuminer-armv8 cpuminer-armv8-crypto cpuminer-avx512-sha-vaes cpuminer-avx512 cpuminer-avx2-sha cpuminer-avx2-sha-vaes cpuminer-avx2 cpuminer-avx cpuminer-aes-sse42 cpuminer-sse42 cpuminer-ssse3 cpuminer-sse2 cpuminer-zen cpuminer-zen3 cpuminer-zen4 cpuminer-alderlake cpuminer-x64 > /dev/null 8 | 9 | # armv9 needs gcc-13 10 | # -march-armv9-a includes SVE2 but no crypto 11 | # -march=armv9-a+crypto adds AES & SHA2 but not SHA512 12 | 13 | make distclean || echo clean 14 | rm -f config.status 15 | ./autogen.sh || echo done 16 | CFLAGS="-O3 -march=armv9-a+crypto+sha3 -Wall -flax-vector-conversions" ./configure --with-curl 17 | make -j $(nproc) 18 | mv cpuminer cpuminer-armv9-crypto-sha3 19 | 20 | make clean || echo clean 21 | CFLAGS="-O3 -march=armv9-a+crypto -Wall -flax-vector-conversions" ./configure --with-curl 22 | make -j $(nproc) 23 | mv cpuminer cpuminer-armv9-crypto 24 | 25 | make clean || echo clean 26 | CFLAGS="-O3 -march=armv9-a -Wall -flax-vector-conversions" ./configure --with-curl 27 | make -j $(nproc) 28 | mv cpuminer cpuminer-armv9 29 | 30 | # SVE2 available in armv8.5 31 | make clean || echo clean 32 | CFLAGS="-O3 -march=armv8.5-a+crypto+sha3+sve2 -Wall -flax-vector-conversions" ./configure --with-curl 33 | make -j $(nproc) 34 | mv cpuminer cpuminer-armv8.5-crypto-sha3-sve2 35 | 36 | # SHA3 available in armv8.4 37 | make clean || echo clean 38 | CFLAGS="-O3 -march=armv8.4-a+crypto+sha3 -Wall -flax-vector-conversions" ./configure --with-curl 39 | make -j $(nproc) 40 | mv cpuminer cpuminer-armv8.4-crypto-sha3 41 | 42 | make clean || echo clean 43 | rm -f config.status 44 | CFLAGS="-O3 -march=armv8-a+crypto -Wall -flax-vector-conversions" ./configure --with-curl 45 | make -j $(nproc) 46 | mv cpuminer cpuminer-armv8-crypto 47 | 48 | make clean || echo clean 49 | rm -f config.status 50 | CFLAGS="-O3 -march=armv8-a -Wall -flax-vector-conversions" ./configure --with-curl 51 | make -j $(nproc) 52 | mv cpuminer cpuminer-armv8 53 | 54 | make clean || echo clean 55 | rm -f config.status 56 | CFLAGS="-O3 -march=native -Wall -flax-vector-conversions" ./configure --with-curl 57 | make -j $(nproc) 58 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # You need autoconf 2.5x, preferably 2.57 or later 4 | # You need automake 1.7 or later. 1.6 might work. 5 | 6 | set -e 7 | 8 | aclocal 9 | autoheader 10 | automake --foreign --add-missing --force-missing --copy 11 | # automake --gnu --add-missing --copy 12 | autoconf 13 | 14 | -------------------------------------------------------------------------------- /build-armv8.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Linux build 4 | 5 | make distclean || echo clean 6 | 7 | rm -f config.status 8 | ./autogen.sh || echo done 9 | 10 | CFLAGS="-O2 -march=armv8-a+crypto+sha2+aes -Wall -flax-vector-conversions" ./configure --with-curl --host=aarch64-cortexa76-elf --build=x86_64-pc-linux-gnu --target=aarch64-cortexa76-elf 11 | #CFLAGS="-O2 -march=armv8-a+crypto+sha2+aes -Wall -flax-vector-conversions" ./configure --with-curl 12 | 13 | make -j $(nproc) 14 | 15 | strip -s cpuminer 16 | -------------------------------------------------------------------------------- /build-avx2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Linux build 4 | 5 | make distclean || echo clean 6 | rm -f config.status 7 | ./autogen.sh || echo done 8 | CFLAGS="-O3 -march=haswell -maes -Wall" ./configure --with-curl 9 | make -j $(nproc) 10 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | make distclean || echo clean 4 | rm -f config.status 5 | ./autogen.sh || echo done 6 | CFLAGS="-O3 -march=native -Wall" ./configure --with-curl 7 | make -j $(nproc) 8 | 9 | #strip -s cpuminer 10 | -------------------------------------------------------------------------------- /clean-all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # make clean and rm all the targetted executables. 4 | 5 | rm cpuminer-avx10* cpuminer-arrowlake* cpuminer-graniterapids* cpuminer-avx512-sha-vaes cpuminer-alderlake cpuminer-avx512 cpuminer-avx2 cpuminer-avx cpuminer-aes-sse42 cpuminer-sse2 cpuminer-avx2-sha cpuminer-sse42 cpuminer-ssse3 cpuminer-avx2-sha-vaes cpuminer-zen3 cpuminer-zen4 cpuminer-x64 cpuminer-armv9 cpuminer-armv9-crypto cpuminer-armv9-crypto-sha3 cpuminer-armv8.4-crypto-sha3 cpuminer-armv8.5-crypto-sha3-sve2 cpuminer-armv8-crypto cpuminer-armv8 > /dev/null 6 | 7 | rm cpuminer-avx512-sha-vaes.exe cpuminer-avx512-sha.exe cpuminer-avx512.exe cpuminer-avx2.exe cpuminer-avx.exe cpuminer-aes-sse42.exe cpuminer-sse2.exe cpuminer-avx2-sha.exe cpuminer-sse42.exe cpuminer-ssse3.exe cpuminer-avx2-sha-vaes.exe cpuminer-zen3.exe cpuminer-zen4.exe cpuminer-x64.exe > /dev/null 8 | 9 | make distclean > /dev/null 10 | -------------------------------------------------------------------------------- /compat.h: -------------------------------------------------------------------------------- 1 | #ifndef __COMPAT_H__ 2 | #define __COMPAT_H__ 3 | 4 | #ifdef WIN32 5 | 6 | #if _WIN32_WINNT>=0x0601 // Windows 7 7 | #define WINDOWS_CPU_GROUPS_ENABLED 1 8 | #endif 9 | 10 | #include 11 | #include 12 | 13 | #ifndef localtime_r 14 | #define localtime_r(src, dst) localtime_s(dst, src) 15 | #endif 16 | 17 | #define sleep(secs) Sleep((secs) * 1000) 18 | 19 | enum { 20 | PRIO_PROCESS = 0, 21 | }; 22 | 23 | extern int opt_priority; 24 | static __inline int setpriority(int which, int who, int prio) 25 | { 26 | switch (opt_priority) { 27 | case 5: 28 | prio = THREAD_PRIORITY_TIME_CRITICAL; 29 | break; 30 | case 4: 31 | prio = THREAD_PRIORITY_HIGHEST; 32 | break; 33 | case 3: 34 | prio = THREAD_PRIORITY_ABOVE_NORMAL; 35 | break; 36 | case 2: 37 | prio = THREAD_PRIORITY_NORMAL; 38 | break; 39 | case 1: 40 | prio = THREAD_PRIORITY_BELOW_NORMAL; 41 | break; 42 | case 0: 43 | default: 44 | prio = THREAD_PRIORITY_IDLE; 45 | } 46 | return -!SetThreadPriority(GetCurrentThread(), prio); 47 | } 48 | 49 | #ifdef _MSC_VER 50 | #define snprintf(...) _snprintf(__VA_ARGS__) 51 | #define strdup(...) _strdup(__VA_ARGS__) 52 | #define strncasecmp(x,y,z) _strnicmp(x,y,z) 53 | #define strcasecmp(x,y) _stricmp(x,y) 54 | #define __func__ __FUNCTION__ 55 | #define __thread __declspec(thread) 56 | #define _ALIGN(x) __declspec(align(x)) 57 | typedef int ssize_t; 58 | 59 | #include 60 | // This static var is made to be compatible with linux/mingw (no free on string result) 61 | // This is not thread safe but we only use that once on process start 62 | static char dirname_buffer[_MAX_PATH] = { 0 }; 63 | static __inline char * dirname(char *file) { 64 | char drive[_MAX_DRIVE] = { 0 }; 65 | char dir[_MAX_DIR] = { 0 }; 66 | char fname[_MAX_FNAME], ext[_MAX_EXT]; 67 | _splitpath_s(file, drive, _MAX_DRIVE, dir, _MAX_DIR, fname, _MAX_FNAME, ext, _MAX_EXT); 68 | if (dir && strlen(dir) && dir[strlen(dir)-1] == '\\') { 69 | dir[strlen(dir) - 1] = '\0'; 70 | } 71 | sprintf(dirname_buffer, "%s%s", drive, dir); 72 | return &dirname_buffer[0]; 73 | } 74 | #endif 75 | 76 | #endif /* WIN32 */ 77 | 78 | #ifndef _MSC_VER 79 | #define _ALIGN(x) __attribute__ ((aligned(x))) 80 | #endif 81 | 82 | #undef unlikely 83 | #undef likely 84 | #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) 85 | #define unlikely(expr) (__builtin_expect(!!(expr), 0)) 86 | #define likely(expr) (__builtin_expect(!!(expr), 1)) 87 | #else 88 | #define unlikely(expr) (expr) 89 | #define likely(expr) (expr) 90 | #endif 91 | 92 | #ifndef WIN32 93 | #define MAX_PATH PATH_MAX 94 | #endif 95 | 96 | #endif /* __COMPAT_H__ */ 97 | -------------------------------------------------------------------------------- /compat/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | if WANT_JANSSON 3 | SUBDIRS = jansson 4 | else 5 | SUBDIRS = 6 | endif 7 | 8 | -------------------------------------------------------------------------------- /compat/gettimeofday.c: -------------------------------------------------------------------------------- 1 | #include < time.h > 2 | #include //I've ommited this line. 3 | #if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) 4 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 5 | #else 6 | #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL 7 | #endif 8 | 9 | struct timezone 10 | { 11 | int tz_minuteswest; /* minutes W of Greenwich */ 12 | int tz_dsttime; /* type of dst correction */ 13 | }; 14 | 15 | int gettimeofday(struct timeval *tv, struct timezone *tz) 16 | { 17 | FILETIME ft; 18 | unsigned __int64 tmpres = 0; 19 | static int tzflag; 20 | 21 | if (NULL != tv) 22 | { 23 | GetSystemTimeAsFileTime(&ft); 24 | 25 | tmpres |= ft.dwHighDateTime; 26 | tmpres <<= 32; 27 | tmpres |= ft.dwLowDateTime; 28 | 29 | /*converting file time to unix epoch*/ 30 | tmpres /= 10; /*convert into microseconds*/ 31 | tmpres -= DELTA_EPOCH_IN_MICROSECS; 32 | tv->tv_sec = (long)(tmpres / 1000000UL); 33 | tv->tv_usec = (long)(tmpres % 1000000UL); 34 | } 35 | 36 | if (NULL != tz) 37 | { 38 | if (!tzflag) 39 | { 40 | _tzset(); 41 | tzflag++; 42 | } 43 | tz->tz_minuteswest = _timezone / 60; 44 | tz->tz_dsttime = _daylight; 45 | } 46 | 47 | return 0; 48 | } 49 | 50 | void usleep(__int64 waitTime) 51 | { 52 | if (waitTime > 0) 53 | { 54 | if (waitTime > 100) 55 | { 56 | // use a waitable timer for larger intervals > 0.1ms 57 | 58 | HANDLE timer; 59 | LARGE_INTEGER ft; 60 | 61 | ft.QuadPart = -(10*waitTime); // Convert to 100 nanosecond interval, negative value indicates relative time 62 | 63 | timer = CreateWaitableTimer(NULL, TRUE, NULL); 64 | SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); 65 | WaitForSingleObject(timer, INFINITE); 66 | CloseHandle(timer); 67 | } 68 | else 69 | { 70 | // use a polling loop for short intervals <= 100ms 71 | 72 | LARGE_INTEGER perfCnt, start, now; 73 | __int64 elapsed; 74 | 75 | QueryPerformanceFrequency(&perfCnt); 76 | QueryPerformanceCounter(&start); 77 | do { 78 | QueryPerformanceCounter((LARGE_INTEGER*) &now); 79 | elapsed = (__int64)((now.QuadPart - start.QuadPart) / (float)perfCnt.QuadPart * 1000 * 1000); 80 | } while ( elapsed < waitTime ); 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /compat/inttypes.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | -------------------------------------------------------------------------------- /compat/jansson/.gitignore: -------------------------------------------------------------------------------- 1 | *.h.in 2 | *.h.in~ 3 | libtool 4 | libjansson.a 5 | -------------------------------------------------------------------------------- /compat/jansson/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009, 2010 Petri Lehtinen 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /compat/jansson/Makefile.am: -------------------------------------------------------------------------------- 1 | 2 | noinst_LIBRARIES = libjansson.a 3 | 4 | libjansson_a_SOURCES = \ 5 | config.h \ 6 | dump.c \ 7 | error.c \ 8 | hashtable.c hashtable.h \ 9 | jansson.h \ 10 | jansson_config.h \ 11 | jansson_private.h \ 12 | load.c \ 13 | memory.c \ 14 | pack_unpack.c \ 15 | strbuffer.c strbuffer.h \ 16 | strconv.c \ 17 | utf.c utf.h \ 18 | util.h \ 19 | value.c 20 | 21 | -------------------------------------------------------------------------------- /compat/jansson/error.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "jansson_private.h" 3 | 4 | void jsonp_error_init(json_error_t *error, const char *source) 5 | { 6 | if(error) 7 | { 8 | error->text[0] = '\0'; 9 | error->line = -1; 10 | error->column = -1; 11 | error->position = 0; 12 | if(source) 13 | jsonp_error_set_source(error, source); 14 | else 15 | error->source[0] = '\0'; 16 | } 17 | } 18 | 19 | void jsonp_error_set_source(json_error_t *error, const char *source) 20 | { 21 | size_t length; 22 | 23 | if(!error || !source) 24 | return; 25 | 26 | length = strlen(source); 27 | if(length < JSON_ERROR_SOURCE_LENGTH) 28 | strcpy(error->source, source); 29 | else { 30 | size_t extra = length - JSON_ERROR_SOURCE_LENGTH + 4; 31 | strcpy(error->source, "..."); 32 | strcpy(error->source + 3, source + extra); 33 | } 34 | } 35 | 36 | void jsonp_error_set(json_error_t *error, int line, int column, 37 | size_t position, const char *msg, ...) 38 | { 39 | va_list ap; 40 | 41 | va_start(ap, msg); 42 | jsonp_error_vset(error, line, column, position, msg, ap); 43 | va_end(ap); 44 | } 45 | 46 | void jsonp_error_vset(json_error_t *error, int line, int column, 47 | size_t position, const char *msg, va_list ap) 48 | { 49 | if(!error) 50 | return; 51 | 52 | if(error->text[0] != '\0') { 53 | /* error already set */ 54 | return; 55 | } 56 | 57 | error->line = line; 58 | error->column = column; 59 | error->position = position; 60 | 61 | vsnprintf(error->text, JSON_ERROR_TEXT_LENGTH, msg, ap); 62 | error->text[JSON_ERROR_TEXT_LENGTH - 1] = '\0'; 63 | } 64 | -------------------------------------------------------------------------------- /compat/jansson/jansson_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | * 7 | * 8 | * This file specifies a part of the site-specific configuration for 9 | * Jansson, namely those things that affect the public API in 10 | * jansson.h. 11 | * 12 | * The configure script copies this file to jansson_config.h and 13 | * replaces @var@ substitutions by values that fit your system. If you 14 | * cannot run the configure script, you can do the value substitution 15 | * by hand. 16 | */ 17 | 18 | #ifndef JANSSON_CONFIG_H 19 | #define JANSSON_CONFIG_H 20 | /* If your compiler supports the inline keyword in C, JSON_INLINE is 21 | defined to `inline', otherwise empty. In C++, the inline is always 22 | supported. */ 23 | 24 | #ifdef _MSC_VER 25 | #define inline __inline 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | #define JSON_INLINE inline 30 | #else 31 | #define JSON_INLINE inline 32 | #endif 33 | 34 | /* If your compiler supports the `long long` type and the strtoll() 35 | library function, JSON_INTEGER_IS_LONG_LONG is defined to 1, 36 | otherwise to 0. */ 37 | #define JSON_INTEGER_IS_LONG_LONG 1 38 | 39 | /* If locale.h and localeconv() are available, define to 1, 40 | otherwise to 0. */ 41 | #define JSON_HAVE_LOCALECONV 1 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /compat/jansson/memory.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * Copyright (c) 2011-2012 Basile Starynkevitch 4 | * 5 | * Jansson is free software; you can redistribute it and/or modify it 6 | * under the terms of the MIT license. See LICENSE for details. 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "jansson.h" 13 | #include "jansson_private.h" 14 | 15 | /* memory function pointers */ 16 | static json_malloc_t do_malloc = malloc; 17 | static json_free_t do_free = free; 18 | 19 | void *jsonp_malloc(size_t size) 20 | { 21 | if(!size) 22 | return NULL; 23 | 24 | return (*do_malloc)(size); 25 | } 26 | 27 | void jsonp_free(void *ptr) 28 | { 29 | if(!ptr) 30 | return; 31 | 32 | (*do_free)(ptr); 33 | } 34 | 35 | char *jsonp_strdup(const char *str) 36 | { 37 | char *new_str; 38 | size_t len; 39 | 40 | len = strlen(str); 41 | if(len == (size_t)-1) 42 | return NULL; 43 | 44 | new_str = jsonp_malloc(len + 1); 45 | if(!new_str) 46 | return NULL; 47 | 48 | memcpy(new_str, str, len + 1); 49 | return new_str; 50 | } 51 | 52 | void json_set_alloc_funcs(json_malloc_t malloc_fn, json_free_t free_fn) 53 | { 54 | do_malloc = malloc_fn; 55 | do_free = free_fn; 56 | } 57 | -------------------------------------------------------------------------------- /compat/jansson/strbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef STRBUFFER_H 9 | #define STRBUFFER_H 10 | 11 | typedef struct { 12 | char *value; 13 | size_t length; /* bytes used */ 14 | size_t size; /* bytes allocated */ 15 | } strbuffer_t; 16 | 17 | int strbuffer_init(strbuffer_t *strbuff); 18 | void strbuffer_close(strbuffer_t *strbuff); 19 | 20 | void strbuffer_clear(strbuffer_t *strbuff); 21 | 22 | const char *strbuffer_value(const strbuffer_t *strbuff); 23 | 24 | /* Steal the value and close the strbuffer */ 25 | char *strbuffer_steal_value(strbuffer_t *strbuff); 26 | 27 | int strbuffer_append(strbuffer_t *strbuff, const char *string); 28 | int strbuffer_append_byte(strbuffer_t *strbuff, char byte); 29 | int strbuffer_append_bytes(strbuffer_t *strbuff, const char *data, size_t size); 30 | 31 | char strbuffer_pop(strbuffer_t *strbuff); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /compat/jansson/utf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009-2013 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef UTF_H 9 | #define UTF_H 10 | 11 | #ifdef HAVE_CONFIG_H 12 | #include 13 | 14 | #ifdef HAVE_INTTYPES_H 15 | /* inttypes.h includes stdint.h in a standard environment, so there's 16 | no need to include stdint.h separately. If inttypes.h doesn't define 17 | int32_t, it's defined in config.h. */ 18 | #include 19 | #endif /* HAVE_INTTYPES_H */ 20 | 21 | #else /* !HAVE_CONFIG_H */ 22 | #ifdef _WIN32 23 | typedef int int32_t; 24 | #else /* !_WIN32 */ 25 | /* Assume a standard environment */ 26 | #include 27 | #endif /* _WIN32 */ 28 | 29 | #endif /* HAVE_CONFIG_H */ 30 | 31 | int utf8_encode(int codepoint, char *buffer, int *size); 32 | 33 | int utf8_check_first(char byte); 34 | int utf8_check_full(const char *buffer, int size, int32_t *codepoint); 35 | const char *utf8_iterate(const char *buffer, int32_t *codepoint); 36 | 37 | int utf8_check_string(const char *string, int length); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /compat/jansson/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2009, 2010 Petri Lehtinen 3 | * 4 | * Jansson is free software; you can redistribute it and/or modify 5 | * it under the terms of the MIT license. See LICENSE for details. 6 | */ 7 | 8 | #ifndef UTIL_H 9 | #define UTIL_H 10 | 11 | #ifndef max 12 | #define max(a, b) ((a) > (b) ? (a) : (b)) 13 | #endif 14 | 15 | #endif 16 | -------------------------------------------------------------------------------- /compat/pthreads/x64/libpthreadGC2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/compat/pthreads/x64/libpthreadGC2.a -------------------------------------------------------------------------------- /compat/pthreads/x64/pthreadVC2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/compat/pthreads/x64/pthreadVC2.lib -------------------------------------------------------------------------------- /compat/pthreads/x86/pthreadVC2.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/compat/pthreads/x86/pthreadVC2.lib -------------------------------------------------------------------------------- /compat/sha3-defs.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef DEFS_X5_H__ 3 | #define DEFS_X5_H__ 4 | typedef unsigned char BitSequence; 5 | typedef unsigned long long DataLength; 6 | typedef enum { SUCCESS = 0, FAIL = 1, BAD_HASHBITLEN = 2} HashReturn; 7 | 8 | typedef unsigned char uint8; 9 | typedef unsigned int uint32; 10 | typedef unsigned long long uint64; 11 | 12 | //typedef struct { 13 | // uint32 buffer[8]; /* Buffer to be hashed */ 14 | // __m128i chainv[10]; /* Chaining values */ 15 | // uint64 bitlen[2]; /* Message length in bits */ 16 | // uint32 rembitlen; /* Length of buffer data to be hashed */ 17 | // int hashbitlen; 18 | //} hashState_luffa; 19 | 20 | typedef unsigned char byte; 21 | #endif 22 | -------------------------------------------------------------------------------- /compat/sha3_common.h: -------------------------------------------------------------------------------- 1 | /* 2 | * file : sha3_common.h 3 | * version : 1.0.208 4 | * date : 14.12.2010 5 | * 6 | * Common declarations 7 | * 8 | * Cagdas Calik 9 | * ccalik@metu.edu.tr 10 | * Institute of Applied Mathematics, Middle East Technical University, Turkey. 11 | * 12 | */ 13 | #include "sha3-defs.h" 14 | #ifndef SHA3_COMMON_H 15 | #define SHA3_COMMON_H 16 | 17 | 18 | #ifdef __GNUC__ 19 | #define MYALIGN __attribute__((aligned(16))) 20 | #else 21 | #define MYALIGN __declspec(align(16)) 22 | #endif 23 | 24 | #define M128(x) *((__m128i*)x) 25 | 26 | 27 | //typedef unsigned char BitSequence; 28 | //typedef unsigned long long DataLength; 29 | //typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHBITLEN = 2} HashReturn; 30 | 31 | #endif // SHA3_COMMON_H 32 | -------------------------------------------------------------------------------- /compat/stdbool.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define false 0 4 | #define true 1 5 | 6 | #define bool int 7 | -------------------------------------------------------------------------------- /compat/sys/time.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifdef __cplusplus 4 | extern "C" 5 | { 6 | #endif 7 | int gettimeofday(struct timeval *tv, struct timezone *tz); 8 | void usleep(__int64 usec); 9 | #ifdef __cplusplus 10 | } 11 | #endif 12 | typedef __int64 useconds_t; 13 | -------------------------------------------------------------------------------- /compat/unistd.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "getopt/getopt.h" -------------------------------------------------------------------------------- /compat/winansi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ANSI emulation wrappers 3 | */ 4 | #ifdef WIN32 5 | #include 6 | #include 7 | #include 8 | 9 | #define isatty(fd) _isatty(fd) 10 | #define fileno(fd) _fileno(fd) 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | int winansi_fputs(const char *str, FILE *stream); 16 | int winansi_printf(const char *format, ...); 17 | int winansi_fprintf(FILE *stream, const char *format, ...); 18 | int winansi_vfprintf(FILE *stream, const char *format, va_list list); 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #undef fputs 24 | #undef fprintf 25 | #undef vfprintf 26 | 27 | #define fputs winansi_fputs 28 | #define printf winansi_printf 29 | #define fprintf winansi_fprintf 30 | #define vfprintf winansi_vfprintf 31 | 32 | #endif -------------------------------------------------------------------------------- /config-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "_comment" : "Any long-format command line argument ", 3 | "_comment" : "may be used in this JSON configuration file", 4 | "_comment" : "Additional arguments may be added to the command line.", 5 | "_comment" : "Usage: cpuminer -c myconfig.json [additional arguments]", 6 | 7 | "_comment" : "Required arguments, replace dummy values", 8 | 9 | "url" : "stratum+tcp://example.com:3333", 10 | "user" : "read.pool.instructions", 11 | "pass" : "x.often.works", 12 | "algo" : "algo", 13 | 14 | "_comment" : "Often used optional arguments with default values selected.", 15 | "_comment" : "Change values, add or delete arguments as desired.", 16 | 17 | "threads" : 0, 18 | "cpu-affinity" : -1, 19 | "api-bind" : "127.0.0.1:4048", 20 | "benchmark" : false, 21 | "quiet" : false 22 | } 23 | -------------------------------------------------------------------------------- /dummy.cpp: -------------------------------------------------------------------------------- 1 | // This file exists to force the use of g++ as the linker which in turn 2 | // links the math library with the inclusion of math.h. gcc will not 3 | // automatically link math. Without this file linking will fail for m7m.c. 4 | // Linking math manually, allowing gcc to do the linking work on Linux 5 | // but on Windows it segfaults. Until that is solved this file must continue 6 | // to exist. 7 | -------------------------------------------------------------------------------- /junk/Android.mk: -------------------------------------------------------------------------------- 1 | ################################################################ 2 | # Sample Android repo Makefile, used to test arm on the Tegra K1 3 | ################################################################ 4 | 5 | cpuminer-src := $(call my-dir) 6 | 7 | LOCAL_PATH := $(cpuminer-src) 8 | include $(CLEAR_VARS) 9 | 10 | LOCAL_MODULE=cpuminer-jansson 11 | LOCAL_MODULE_TAGS=optional 12 | 13 | define all-c-files-under 14 | $(patsubst ./%,%, \ 15 | $(shell cd $(LOCAL_PATH) ; \ 16 | find -L $(1) -name "*.c" -and -not -name ".*") \ 17 | ) 18 | endef 19 | 20 | LOCAL_SRC_FILES := $(call all-c-files-under,compat/jansson) 21 | LOCAL_C_INCLUDES := $(cpuminer-src)/compat/jansson 22 | 23 | include $(BUILD_STATIC_LIBRARY) 24 | 25 | ################################################################ 26 | 27 | 28 | LOCAL_PATH := $(cpuminer-src) 29 | include $(CLEAR_VARS) 30 | 31 | LOCAL_MODULE=cpuminer 32 | LOCAL_MODULE_TAGS=optional 33 | LOCAL_MODULE_CLASS := UTILITY_EXECUTABLES 34 | LOCAL_MODULE_PATH := $(PRODUCT_OUT)/utilities 35 | LOCAL_MODULE_STEM := $(LOCAL_MODULE) 36 | 37 | LOCAL_C_INCLUDES := $(cpuminer-src)/compat/bionic \ 38 | $(cpuminer-src)/compat/jansson \ 39 | $(TARGET_OUT_INTERMEDIATES)/include/libcurl \ 40 | external/openssl/include \ 41 | 42 | LOCAL_CFLAGS := -std=c99 -Wno-pointer-sign -Wno-missing-field-initializers \ 43 | -Wno-unused-parameter #-DNOASM 44 | LOCAL_CFLAGS += -DVERSION=\"1.2\" 45 | 46 | sph_files:=$(call all-c-files-under,sha3) 47 | 48 | LOCAL_SRC_FILES=\ 49 | cpu-miner.c util.c \ 50 | api.c sysinfos.c \ 51 | $(call all-c-files-under,algo) \ 52 | $(filter-out sha3/md_helper.c,$(sph_files)) \ 53 | $(call all-c-files-under,crypto) \ 54 | $(call all-c-files-under,lyra2) \ 55 | asm/sha2-$(TARGET_ARCH).S \ 56 | asm/scrypt-$(TARGET_ARCH).S \ 57 | asm/neoscrypt_asm.S 58 | 59 | LOCAL_STATIC_LIBRARIES := libm cpuminer-jansson 60 | LOCAL_STATIC_LIBRARIES += libz libcrypto_static 61 | LOCAL_STATIC_LIBRARIES += libssl_static 62 | 63 | # Require curl config changes and an addional 64 | # module definition in external/curl(_static?) 65 | #LOCAL_FORCE_STATIC_EXECUTABLE := true 66 | 67 | ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true) 68 | LOCAL_CFLAGS += -DCURL_STATICLIB # -DHTTP_ONLY 69 | LOCAL_STATIC_LIBRARIES += libcurl_static libc 70 | else 71 | LOCAL_SHARED_LIBRARIES := libssl libcrypto 72 | LOCAL_SHARED_LIBRARIES += libcurl 73 | #LOCAL_STATIC_LIBRARIES += libcurl_static 74 | endif 75 | 76 | include $(BUILD_EXECUTABLE) 77 | 78 | -------------------------------------------------------------------------------- /junk/cpuminer.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio 2013 3 | VisualStudioVersion = 12.0.30723.0 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cpuminer", "cpuminer.vcxproj", "{36DC07F9-A4A6-4877-A146-1B960083CF6F}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|x64 = Debug|x64 10 | Debug|Win32 = Debug|Win32 11 | Release|x64 = Release|x64 12 | Release|Win32 = Release|Win32 13 | EndGlobalSection 14 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 15 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.ActiveCfg = Debug|x64 16 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.ActiveCfg = Debug|Win32 17 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|x64.Build.0 = Debug|x64 18 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Debug|Win32.Build.0 = Debug|Win32 19 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.ActiveCfg = Release|x64 20 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|x64.Build.0 = Release|x64 21 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.ActiveCfg = Release|Win32 22 | {36DC07F9-A4A6-4877-A146-1B960083CF6F}.Release|Win32.Build.0 = Release|Win32 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | EndGlobal 28 | -------------------------------------------------------------------------------- /junk/mingw64.sh: -------------------------------------------------------------------------------- 1 | ./autogen.sh 2 | 3 | CURL_PREFIX=/usr/local 4 | SSL_PREFIX=/usr/local/ssl 5 | 6 | # gcc 4.4 7 | extracflags="-O3 -Wall -D_REENTRANT -fmerge-all-constants" # -funroll-loops -fvariable-expansion-in-unroller -fbranch-target-load-optimize2 -fsched2-use-superblocks -falign-loops=16 -falign-functions=16 -falign-jumps=16 -falign-labels=16" 8 | 9 | # gcc 4.8+ 10 | # extracflags="$extracflags -Ofast -fuse-linker-plugin -ftree-loop-if-convert-stores" # -flto " 11 | 12 | # extracflags="-pg -static -fno-inline-small-functions" 13 | CFLAGS="-DCURL_STATICLIB -DOPENSSL_NO_ASM -DUSE_ASM $extracflags" 14 | # CPPFLAGS="" 15 | 16 | # icon 17 | windres res/icon.rc icon.o 18 | 19 | ./configure --build=x86_64-w64-mingw32 --with-crypto=$SSL_PREFIX --with-curl=$CURL_PREFIX \ 20 | CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" LDFLAGS="icon.o" 21 | 22 | make 23 | 24 | strip -p --strip-debug --strip-unneeded cpuminer.exe 25 | 26 | if [ -e sign.sh ] ; then 27 | . sign.sh 28 | fi 29 | 30 | -------------------------------------------------------------------------------- /m4/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | # Except this file 4 | !.gitignore 5 | -------------------------------------------------------------------------------- /malloc-huge.c: -------------------------------------------------------------------------------- 1 | #include "malloc-huge.h" 2 | #include "miner.h" 3 | 4 | #define HUGEPAGE_SIZE_2M (2 * 1024 * 1024) 5 | 6 | void *malloc_hugepages( size_t size ) 7 | { 8 | #if !(defined(MAP_HUGETLB) && defined(MAP_ANON)) 9 | // applog( LOG_WARNING, "Huge pages not available",size); 10 | return NULL; 11 | #else 12 | 13 | if ( size < HUGEPAGE_MIN_ALLOC ) 14 | { 15 | // applog( LOG_WARNING, "Block too small for huge pages: %lu bytes",size); 16 | return NULL; 17 | } 18 | 19 | const size_t hugepage_mask = (size_t)HUGEPAGE_SIZE_2M - 1; 20 | void *p = NULL; 21 | int flags = 22 | #ifdef MAP_NOCORE 23 | MAP_NOCORE | 24 | #endif 25 | MAP_HUGETLB | MAP_ANON | MAP_PRIVATE; 26 | 27 | // round size up to next page boundary 28 | size = ( size + hugepage_mask ) & (~hugepage_mask); 29 | 30 | p = mmap( NULL, size, PROT_READ | PROT_WRITE, flags, -1, 0 ); 31 | if ( p == MAP_FAILED ) 32 | p = NULL; 33 | return p; 34 | #endif 35 | } 36 | 37 | -------------------------------------------------------------------------------- /malloc-huge.h: -------------------------------------------------------------------------------- 1 | #if !(defined(MALLOC_HUGE__)) 2 | #define MALLOC_HUGE__ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #ifdef __unix__ 10 | #include 11 | #endif 12 | 13 | #if defined(MAP_HUGETLB) 14 | 15 | // Minimum block size 6 MiB to use huge pages 16 | #define HUGEPAGE_MIN_ALLOC (6 * 1024 * 1024) 17 | 18 | #endif 19 | 20 | // Attempt to allocate memory backed by 2 MiB pages, returns NULL on failure. 21 | void *malloc_hugepages( size_t size ); 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /nomacro.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | # Copyright 2012 pooler@litecoinpool.org 3 | # 4 | # This program is free software; you can redistribute it and/or modify it 5 | # under the terms of the GNU General Public License as published by the Free 6 | # Software Foundation; either version 2 of the License, or (at your option) 7 | # any later version. See COPYING for more details. 8 | # 9 | # nomacro.pl - convert assembler macros to C preprocessor macros. 10 | 11 | use strict; 12 | 13 | foreach my $f (<*.S>) { 14 | rename $f, "$f.orig"; 15 | open FIN, "$f.orig"; 16 | open FOUT, ">$f"; 17 | my $inmacro = 0; 18 | my %macros = (); 19 | while () { 20 | if (m/^\.macro\s+([_0-9A-Z]+)(?:\s*)(.*)$/i) { 21 | print FOUT "#define $1($2) \\\n"; 22 | $macros{$1} = 1; 23 | $inmacro = 1; 24 | next; 25 | } 26 | if (m/^\.endm/) { 27 | print FOUT "\n"; 28 | $inmacro = 0; 29 | next; 30 | } 31 | for my $m (keys %macros) { 32 | s/^([ \t]*)($m)(?:[ \t]+([^#\n]*))?([;\n])/\1\2(\3)\4/; 33 | } 34 | if ($inmacro) { 35 | if (m/^\s*#if/) { 36 | $_ = while (!m/^\s*#endif/); 37 | next; 38 | } 39 | next if (m/^\s*$/); 40 | s/\\//g; 41 | s/$/; \\/; 42 | } 43 | print FOUT; 44 | } 45 | close FOUT; 46 | close FIN; 47 | } 48 | -------------------------------------------------------------------------------- /res/cpuminer.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/res/cpuminer.ico -------------------------------------------------------------------------------- /res/cpuminer.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/res/cpuminer.rc -------------------------------------------------------------------------------- /res/icon.rc: -------------------------------------------------------------------------------- 1 | 0 ICON cpuminer.ico 2 | -------------------------------------------------------------------------------- /res/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/res/resource.h -------------------------------------------------------------------------------- /res/setup.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JayDDee/cpuminer-opt/dd99580a4c05414562ccc1bffca7cdce2073fa29/res/setup.ico --------------------------------------------------------------------------------