Skip to content

Commit

Permalink
Add Qubit and Nist5 algos
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Nov 2, 2014
1 parent 3bf8615 commit 9f3083c
Show file tree
Hide file tree
Showing 15 changed files with 358 additions and 92 deletions.
94 changes: 46 additions & 48 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,51 @@ bin_PROGRAMS = minerd

dist_man_MANS = minerd.1

minerd_SOURCES = elist.h \
miner.h \
compat.h \
cpu-miner.c \
util.c \
sha2.c \
scrypt.c \
keccak.c \
heavy.c \
quark.c \
skein.c \
ink.c \
blake.c \
cryptonight.c \
fresh.c \
neoscrypt.c \
s3.c \
x11.c \
x13.c \
x14.c \
x15.c \
pentablake.c \
sha3/blake2s.c \
sha3/sph_keccak.c \
sha3/sph_hefty1.c \
sha3/sph_groestl.c \
sha3/sph_skein.c \
sha3/sph_bmw.c \
sha3/sph_jh.c \
sha3/sph_shavite.c \
sha3/sph_blake.c \
sha3/sph_luffa.c \
sha3/sph_cubehash.c \
sha3/sph_simd.c \
sha3/sph_echo.c \
sha3/sph_hamsi.c \
sha3/sph_fugue.c \
sha3/sph_shabal.c \
sha3/sph_whirlpool.c \
crypto/oaes_lib.c \
crypto/c_keccak.c \
crypto/c_groestl.c \
crypto/c_blake256.c \
crypto/c_jh.c \
crypto/c_skein.c \
crypto/hash.c \
crypto/aesb.c
minerd_SOURCES = \
cpu-miner.c util.c \
sha3/sph_keccak.c \
sha3/sph_hefty1.c \
sha3/sph_groestl.c \
sha3/sph_skein.c \
sha3/sph_bmw.c \
sha3/sph_jh.c \
sha3/sph_shavite.c \
sha3/sph_blake.c \
sha3/sph_luffa.c \
sha3/sph_cubehash.c \
sha3/sph_simd.c \
sha3/sph_echo.c \
sha3/sph_hamsi.c \
sha3/sph_fugue.c \
sha3/sph_shabal.c \
sha3/sph_whirlpool.c \
crypto/blake2s \
crypto/oaes_lib.c \
crypto/c_keccak.c \
crypto/c_groestl.c \
crypto/c_blake256.c \
crypto/c_jh.c \
crypto/c_skein.c \
crypto/hash.c \
crypto/aesb.c \
blake.c \
cryptonight.c \
fresh.c \
heavy.c \
ink.c \
keccak.c \
pentablake.c \
quark.c \
neoscrypt.c \
nist5.c \
qubit.c \
scrypt.c sha2.c \
skein.c \
s3.c \
x11.c \
x13.c \
x14.c \
x15.c

if USE_ASM
minerd_SOURCES += neoscrypt_asm.S
Expand All @@ -83,7 +81,7 @@ endif
minerd_LDFLAGS = @LDFLAGS@
minerd_LDADD = @LIBCURL@ @JANSSON_LIBS@ @PTHREAD_LIBS@ @WS2_LIBS@
minerd_CPPFLAGS = @LIBCURL_CPPFLAGS@
minerd_CFLAGS = -Wno-pointer-sign
minerd_CFLAGS = -Wno-pointer-sign -Wno-pointer-to-int-cast

if HAVE_WINDOWS
minerd_CFLAGS += -Wl,--stack,10485760
Expand Down
9 changes: 6 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
Version multi 1.0.6 (Tanguy Pruvot)
Version 1.0.7 (Tanguy Pruvot)
- Add NIST5 and QUBIT algos

Version 1.0.6 (Tanguy Pruvot)
- Fix scrypt algo
- More work on VC2013
- Add -f tuning option to test with reduced difficulty
- Add S3 algo

Version multi 1.0.5 (Tanguy Pruvot)
Version 1.0.5 (Tanguy Pruvot)

- Merge remaining v2.4 cpu-miner changes
- Add colored output (disable with --no-color)
Expand All @@ -14,7 +17,7 @@ Version multi 1.0.5 (Tanguy Pruvot)
- Windows (VC++ 2013 and MinGW64 build support)
- Enhance --version informations (compiler + lib versions)

Version multi 1.0.4 (Tanguy Pruvot)
Version 1.0.4 (Tanguy Pruvot)

- Add x13 x14 and x15 algos (Sherlockcoin, X14Coin, Webcoin..)
- Add scrypt:N variants (Vertcoin)
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CPUMiner-Multi
CPUMiner-Multi
==============

[![Build Status](https://travis-ci.org/tpruvot/cpuminer-multi.svg)](https://travis-ci.org/tpruvot/cpuminer-multi)
Expand All @@ -23,16 +23,18 @@ Algorithms
*__scrypt__ (Litecoin, Dogecoin, Feathercoin, etc..)
*__scrypt:N__ (Vertcoin [VTC])
*__sha256d__ (Bitcoin, Freicoin, Peercoin/PPCoin, Terracoin, etc..)
*__blake__ (Neos/Saffron Blake-256)
*__cryptonight__ (Bytecoin [BCN], Monero)
*__fresh__ (FreshCoin)
*__neoscrypt__ (Feathercoin)
*__nist5__
*__pentablake__ (Joincoin)
*__qubit__
*__s3__ (OneCoin)
*__x11__ (Darkcoin [DRK], Hirocoin, Limecoin)
*__x13__ (Sherlockcoin, [ACE], [B2B], [GRC], [XHC], etc..)
*__x14__ (X14, Webcoin [WEB])
*__x15__ (RadianceCoin [RCE])
*__cryptonight__ (Bytecoin [BCN], Monero)
*__fresh__ (FreshCoin)
*__blake__ (Neos/Saffron Blake-256)
*__neoscrypt__ (Feathercoin)
*__pentablake__ (Joincoin)

#### Implemented, but untested
* ? keccak (Maxcoin HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([cpuminer-multi], [1.0.6])
AC_INIT([cpuminer-multi], [1.0.7])

AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM
Expand Down
34 changes: 25 additions & 9 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
#include "miner.h"

#ifdef WIN32
#include <Mmsystem.h>
#pragma comment(lib, "winmm.lib")
#include "compat/winansi.h"
BOOL WINAPI ConsoleHandler(DWORD);
#endif
#ifdef _MSC_VER
#include <Mmsystem.h>
#pragma comment(lib, "winmm.lib")
#endif

#define PROGRAM_NAME "cpuminer-multi"

Expand Down Expand Up @@ -130,6 +132,8 @@ enum algos {
ALGO_SHAVITE3, /* Shavite3 */
ALGO_BLAKE, /* Blake */
ALGO_FRESH, /* Fresh */
ALGO_NIST5, /* Nist5 */
ALGO_QUBIT, /* Qubit */
ALGO_S3, /* S3 */
ALGO_X11, /* X11 */
ALGO_X13, /* X13 */
Expand All @@ -151,6 +155,8 @@ static const char *algo_names[] = {
"shavite3",
"blake",
"fresh",
"nist5",
"qubit",
"s3",
"x11",
"x13",
Expand Down Expand Up @@ -235,21 +241,23 @@ Options:\n\
scrypt scrypt(1024, 1, 1) (default)\n\
scrypt:N scrypt(N, 1, 1)\n\
sha256d SHA-256d\n\
keccak Keccak\n\
quark Quark\n\
blake Blake\n\
cryptonight CryptoNight\n\
fresh Fresh\n\
heavy Heavy\n\
keccak Keccak\n\
neoscrypt NeoScrypt(128, 2, 1)\n\
skein Skein\n\
nist5 Nist5\n\
pentablake Pentablake\n\
quark Quark\n\
qubit Qubit\n\
shavite3 Shavite3\n\
blake Blake\n\
fresh Fresh\n\
skein Skein\n\
s3 S3\n\
x11 X11\n\
x13 X13\n\
x14 X14\n\
x15 X15\n\
pentablake Pentablake\n\
cryptonight CryptoNight\n\
-o, --url=URL URL of mining server\n\
-O, --userpass=U:P username:password pair for mining server\n\
-u, --user=USERNAME username for mining server\n\
Expand Down Expand Up @@ -1746,6 +1754,14 @@ static void *miner_thread(void *userdata)
rc = scanhash_fresh(thr_id, work.data, work.target, max_nonce,
&hashes_done);
break;
case ALGO_NIST5:
rc = scanhash_nist5(thr_id, work.data, work.target, max_nonce,
&hashes_done);
break;
case ALGO_QUBIT:
rc = scanhash_qubit(thr_id, work.data, work.target, max_nonce,
&hashes_done);
break;
case ALGO_S3:
rc = scanhash_s3(thr_id, work.data, work.target, max_nonce,
&hashes_done);
Expand Down
8 changes: 5 additions & 3 deletions cpuminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
<ClCompile Include="crypto\oaes_lib.c" />
<ClCompile Include="ink.c" />
<ClCompile Include="s3.c" />
<ClCompile Include="sha3\blake2s.c" />
<ClCompile Include="crypto\blake2s.c" />
<ClCompile Include="sha3\sph_hefty1.c" />
<ClCompile Include="util.c">
<Optimization Condition="'$(Configuration)'=='Release'">Full</Optimization>
Expand All @@ -197,8 +197,10 @@
<ClCompile Include="heavy.c" />
<ClCompile Include="keccak.c" />
<ClCompile Include="neoscrypt.c" />
<ClCompile Include="nist5.c" />
<ClCompile Include="pentablake.c" />
<ClCompile Include="quark.c" />
<ClCompile Include="qubit.c" />
<ClCompile Include="sha2.c" />
<ClCompile Include="scrypt.c">
<Optimization Condition="'$(Configuration)'=='Release'">Full</Optimization>
Expand Down Expand Up @@ -244,6 +246,7 @@
<ClInclude Include="compat\unistd.h" />
<ClInclude Include="compat\winansi.h" />
<ClInclude Include="cpuminer-config.h" />
<ClInclude Include="crypto\blake2s.h" />
<ClInclude Include="crypto\c_blake256.h" />
<ClInclude Include="crypto\c_groestl.h" />
<ClInclude Include="crypto\c_jh.h" />
Expand Down Expand Up @@ -272,7 +275,6 @@
<ClInclude Include="scryptjane\scrypt-jane-romix.h" />
<ClInclude Include="scryptjane\scrypt-jane-salsa.h" />
<ClInclude Include="scryptjane\scrypt-jane-test-vectors.h" />
<ClInclude Include="sha3\blake2s.h" />
<ClInclude Include="sha3\sph_blake.h" />
<ClInclude Include="sha3\sph_bmw.h" />
<ClInclude Include="sha3\sph_cubehash.h" />
Expand Down Expand Up @@ -324,4 +326,4 @@
<Target Name="AfterClean">
<Delete Files="@(FilesToCopy->'$(OutDir)%(Filename)%(Extension)')" TreatErrorsAsWarnings="true" />
</Target>
</Project>
</Project>
6 changes: 3 additions & 3 deletions cpuminer.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
<Filter>jansson</Filter>
</ClCompile>
<ClCompile Include="ink.c" />
<ClCompile Include="sha3\blake2s.c">
<ClCompile Include="crypto\blake2s.c">
<Filter>crypto</Filter>
</ClCompile>
<ClCompile Include="crypto\c_skein.c">
Expand Down Expand Up @@ -242,7 +242,7 @@
<ClInclude Include="..\ccminer\compat\jansson\config.h">
<Filter>jansson</Filter>
</ClInclude>
<ClInclude Include="sha3\blake2s.h">
<ClInclude Include="crypto\blake2s.h">
<Filter>crypto</Filter>
</ClInclude>
<ClInclude Include="crypto\c_skein.h">
Expand Down Expand Up @@ -367,4 +367,4 @@
<Filter>arch\arm</Filter>
</None>
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion sha3/blake2s.c → crypto/blake2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <stdio.h>

#include "sha3/sph_types.h"
#include "sha3/blake2s.h"
#include "crypto/blake2s.h"

static const uint32_t blake2s_IV[8] =
{
Expand Down
File renamed without changes.
6 changes: 4 additions & 2 deletions crypto/hash-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "int-util.h"

#if 0
static inline void *padd(void *p, size_t i) {
return (char *) p + i;
}
Expand All @@ -23,11 +24,12 @@ static inline const void *cpadd(const void *p, size_t i) {

static inline void place_length(uint8_t *buffer, size_t bufsize, size_t length) {
if (sizeof(size_t) == 4) {
*(uint32_t *) padd(buffer, bufsize - 4) = swap32be(length);
*(uint32_t*) padd(buffer, bufsize - 4) = swap32be(length);
} else {
*(uint64_t *) padd(buffer, bufsize - 8) = swap64be(length);
*(uint64_t*) padd(buffer, bufsize - 8) = swap64be(length);
}
}
#endif

#pragma pack(push, 1)
union hash_state {
Expand Down
12 changes: 10 additions & 2 deletions miner.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ extern int scanhash_blake(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
extern int scanhash_fresh(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done);

extern int scanhash_nist5(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done);

extern int scanhash_qubit(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done);

extern int scanhash_s3(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done);

Expand Down Expand Up @@ -397,19 +403,21 @@ void applog_hash(void *hash);
void print_hash_tests(void);
void sha256d(unsigned char *hash, const unsigned char *data, int len);
void blakehash(void *state, const void *input);
void cryptonight_hash(void* output, const void* input, size_t len);
void heavyhash(unsigned char* output, const unsigned char* input, int len);
void quarkhash(void *state, const void *input);
void skeinhash(void *state, const void *input);
void freshhash(void* output, const void* input, uint32_t len);
void keccakhash(void *state, const void *input);
void inkhash(void *state, const void *input); /* shavite */
void neoscrypt(unsigned char *output, const unsigned char *password, uint32_t profile);
void nist5hash(void *output, const void *input);
void pentablakehash(void *output, const void *input);
void qubithash(void *output, const void *input);
void s3hash(void *output, const void *input);
void x11hash(void *output, const void *input);
void x13hash(void *output, const void *input);
void x14hash(void *output, const void *input);
void x15hash(void *output, const void *input);
void pentablakehash(void *output, const void *input);
void cryptonight_hash(void* output, const void* input, size_t len);

#endif /* __MINER_H__ */
2 changes: 1 addition & 1 deletion neoscrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

#define USE_CUSTOM_BLAKE2S
// TODO: try blake2sp
//#include "sha3/blake2s.h"
//#include "crypto/blake2s.h"

#define STACK_ALIGN 0x40

Expand Down
Loading

0 comments on commit 9f3083c

Please sign in to comment.