Skip to content

Commit

Permalink
Prepare v1.1.x versions..
Browse files Browse the repository at this point in the history
move asm and algos in folders and add groestl support

Add 'groestl' algo (tested on erebor pool)
and 'dmd-gr' for Diamond Coin (tested on us.miningfield.com)

Myriad Groestl not supported yet
  • Loading branch information
tpruvot committed Jan 24, 2015
1 parent 233126d commit ba2fbc7
Show file tree
Hide file tree
Showing 40 changed files with 197 additions and 88 deletions.
48 changes: 25 additions & 23 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,40 @@ cpuminer_SOURCES = \
crypto/hash.c \
crypto/aesb.c \
lyra2/Lyra2.c lyra2/Sponge.c \
blake.c \
cryptonight.c \
fresh.c \
heavy.c \
ink.c \
lyra2re.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
algo/blake.c \
algo/cryptonight.c \
algo/fresh.c \
algo/groestl.c \
algo/heavy.c \
algo/ink.c \
algo/lyra2re.c \
algo/keccak.c \
algo/pentablake.c \
algo/quark.c \
algo/neoscrypt.c \
algo/nist5.c \
algo/qubit.c \
algo/scrypt.c \
algo/sha2.c \
algo/skein.c \
algo/s3.c \
algo/x11.c \
algo/x13.c \
algo/x14.c \
algo/x15.c

disable_flags =

if USE_ASM
cpuminer_SOURCES += neoscrypt_asm.S
cpuminer_SOURCES += asm/neoscrypt_asm.S
if ARCH_x86
cpuminer_SOURCES += sha2-x86.S scrypt-x86.S aesb-x86.S crypto/aesb-x86-impl.c
cpuminer_SOURCES += asm/sha2-x86.S asm/scrypt-x86.S asm/aesb-x86.S
endif
if ARCH_x86_64
cpuminer_SOURCES += sha2-x64.S scrypt-x64.S aesb-x64.S
cpuminer_SOURCES += asm/sha2-x64.S asm/scrypt-x64.S asm/aesb-x64.S
endif
if ARCH_ARM
cpuminer_SOURCES += sha2-arm.S scrypt-arm.S
cpuminer_SOURCES += asm/sha2-arm.S asm/scrypt-arm.S
endif
else
disable_flags += -DNOASM
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
version 1.1-git (Tanguy Pruvot)
- Add GroestlCoin and Diamond Groestl variants

version 1.0.9 (Tanguy Pruvot)
- pool extranonce subscribe
- upgrade jansson
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Algorithms
*__scrypt__ (Litecoin, Dogecoin, Feathercoin, ...)
*__scrypt:N__
*__sha256d__ (Bitcoin, Freicoin, Peercoin/PPCoin, Terracoin, ...)
*__blake__ (Neos/Saffron [SFR] Blake-256)
*__blake__ (Saffron [SFR] Blake-256)
*__cryptonight__ (Bytecoin [BCN], Monero)
*__dmd-gr__ (Diamond-Groestl)
*__fresh__ (FreshCoin)
*__groestl__ (Groestlcoin)
*__lyra2__ (VertCoin [VTC])
*__neoscrypt__ (Feathercoin)
*__nist5__ (MistCoin [MIC], TalkCoin [TAC], ...)
Expand All @@ -41,14 +43,13 @@ Algorithms
* ? keccak (Maxcoin HelixCoin, CryptoMeth, Galleon, 365coin, Slothcoin, BitcointalkCoin)
* ? hefty1 (Heavycoin)
* ? quark (Quarkcoin)
* ? qubit* (Qubitcoin, Myriadcoin)
* ? skein (Skeincoin, Myriadcoin)
* ? shavite3 (INKcoin)

#### Planned support for
* *scrypt-jane* (YaCoin, CopperBars, Pennies, Tickets, etc..)
* *qubit* (Qubitcoin, Myriadcoin)
* *groestl* (Groestlcoin)


Dependencies
============
* libcurl http://curl.haxx.se/libcurl/
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
61 changes: 61 additions & 0 deletions algo/groestl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#include "miner.h"

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>

#include "sha3/sph_groestl.h"

// static __thread sph_groestl512_context ctx;

void groestlhash(void *output, const void *input)
{
uint32_t _ALIGN(32) hash[16];
sph_groestl512_context ctx;

// memset(&hash[0], 0, sizeof(hash));

sph_groestl512_init(&ctx);
sph_groestl512(&ctx, input, 80);
sph_groestl512_close(&ctx, hash);

//sph_groestl512_init(&ctx);
sph_groestl512(&ctx, hash, 64);
sph_groestl512_close(&ctx, hash);

memcpy(output, hash, 32);
}

int scanhash_groestl(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, uint64_t *hashes_done)
{
uint32_t _ALIGN(64) endiandata[20];
const uint32_t first_nonce = pdata[19];
uint32_t nonce = first_nonce;

if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff;

for (int k=0; k < 20; k++)
be32enc(&endiandata[k], ((uint32_t*)pdata)[k]);

do {
const uint32_t Htarg = ptarget[7];
uint32_t hash[8];
be32enc(&endiandata[19], nonce);
groestlhash(hash, endiandata);

if (hash[7] <= Htarg && fulltest(hash, ptarget)) {
pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce;
return 1;
}
nonce++;

} while (nonce < max_nonce && !work_restart[thr_id].restart);

pdata[19] = nonce;
*hashes_done = pdata[19] - first_nonce + 1;
return 0;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions compat/cpuminer-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#define PACKAGE_NAME "cpuminer-multi"

/* Define to the full name and version of this package. */
#define PACKAGE_STRING "cpuminer-multi 1.0.9"
#define PACKAGE_STRING "cpuminer-multi 1.1-git"

/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "cpuminer-multi"
Expand All @@ -103,7 +103,7 @@
#define PACKAGE_URL ""

/* Define to the version of this package. */
#define PACKAGE_VERSION "1.0.9"
#define PACKAGE_VERSION "1.1-git"

/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
Expand Down Expand Up @@ -132,7 +132,7 @@
#define USE_XOP 1

/* Version number of package */
#define VERSION "1.0.9"
#define VERSION "1.1-git"

/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
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.9])
AC_INIT([cpuminer-multi], [1.1-git])

AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM
Expand Down
37 changes: 35 additions & 2 deletions cpu-miner.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ enum algos {
ALGO_SHAVITE3, /* Shavite3 */
ALGO_BLAKE, /* Blake */
ALGO_FRESH, /* Fresh */
ALGO_DMD_GR, /* Diamond */
ALGO_GROESTL, /* Groestl */
ALGO_LYRA2, /* Lyra2RE (Vertcoin) */
ALGO_NIST5, /* Nist5 */
ALGO_QUBIT, /* Qubit */
Expand All @@ -153,6 +155,8 @@ static const char *algo_names[] = {
"shavite3",
"blake",
"fresh",
"dmd-gr",
"groestl",
"lyra2",
"nist5",
"qubit",
Expand Down Expand Up @@ -250,7 +254,9 @@ Options:\n\
sha256d SHA-256d\n\
blake Blake\n\
cryptonight CryptoNight\n\
dmd-gr Diamond-Groestl\n\
fresh Fresh\n\
groestl GroestlCoin\n\
heavy Heavy\n\
keccak Keccak\n\
lyra2 Lyra2RE\n\
Expand Down Expand Up @@ -854,6 +860,7 @@ static bool gbt_work_decode(const json_t *val, struct work *work)

/* generate merkle root */
merkle_tree = (unsigned char**) malloc(32 * ((1 + tx_count + 1) & ~1));

sha256d(merkle_tree[0], cbtx, cbtx_size);
for (i = 0; i < tx_count; i++) {
tmp = json_array_get(txa, i);
Expand Down Expand Up @@ -1539,10 +1546,25 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
memcpy(work->xnonce2, sctx->job.xnonce2, sctx->xnonce2_size);

/* Generate merkle root */
sha256d(merkle_root, sctx->job.coinbase, (int) sctx->job.coinbase_size);
switch (opt_algo) {
case ALGO_HEAVY:
heavyhash(merkle_root, sctx->job.coinbase, (int)sctx->job.coinbase_size);
break;
case ALGO_GROESTL:
case ALGO_KECCAK:
//case ALGO_BLAKECOIN:
SHA256(sctx->job.coinbase, (int) sctx->job.coinbase_size, merkle_root);
break;
default:
sha256d(merkle_root, sctx->job.coinbase, (int) sctx->job.coinbase_size);
}

for (i = 0; i < sctx->job.merkle_count; i++) {
memcpy(merkle_root + 32, sctx->job.merkle[i], 32);
sha256d(merkle_root, merkle_root, 64);
if (opt_algo == ALGO_HEAVY)
heavyhash(merkle_root, merkle_root, 64);
else
sha256d(merkle_root, merkle_root, 64);
}

/* Increment extranonce2 */
Expand Down Expand Up @@ -1582,9 +1604,13 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *work)
case ALGO_NEOSCRYPT:
diff_to_target(work->target, sctx->job.diff / (65536.0 * opt_diff_factor));
break;
case ALGO_FRESH:
case ALGO_DMD_GR:
case ALGO_GROESTL:
case ALGO_QUBIT:
diff_to_target(work->target, sctx->job.diff / (256.0 * opt_diff_factor));
break;
case ALGO_KECCAK:
case ALGO_LYRA2:
diff_to_target(work->target, sctx->job.diff / (128.0 * opt_diff_factor));
break;
Expand Down Expand Up @@ -1714,6 +1740,8 @@ static void *miner_thread(void *userdata)
case ALGO_LYRA2:
max64 = 0xffff;
break;
case ALGO_DMD_GR:
case ALGO_GROESTL:
case ALGO_FRESH:
case ALGO_X11:
max64 = 0x3ffff;
Expand Down Expand Up @@ -1789,6 +1817,11 @@ static void *miner_thread(void *userdata)
rc = scanhash_fresh(thr_id, work.data, work.target, max_nonce,
&hashes_done);
break;
case ALGO_DMD_GR:
case ALGO_GROESTL:
rc = scanhash_groestl(thr_id, work.data, work.target, max_nonce,
&hashes_done);
break;
case ALGO_LYRA2:
rc = scanhash_lyra2(thr_id, work.data, work.target, max_nonce,
&hashes_done);
Expand Down
59 changes: 30 additions & 29 deletions cpuminer.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -191,33 +191,34 @@
<ClCompile Include="crypto\oaes_lib.c" />
<ClCompile Include="lyra2\Lyra2.c" />
<ClCompile Include="lyra2\Sponge.c" />
<ClCompile Include="ink.c" />
<ClCompile Include="lyra2re.c" />
<ClCompile Include="s3.c" />
<ClCompile Include="crypto\blake2s.c" />
<ClCompile Include="sha3\sph_hefty1.c" />
<ClCompile Include="util.c">
<Optimization Condition="'$(Configuration)'=='Release'">Full</Optimization>
</ClCompile>
<ClCompile Include="blake.c" />
<ClCompile Include="cryptonight.c" />
<ClCompile Include="fresh.c" />
<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">
<ClCompile Include="algo\ink.c" />
<ClCompile Include="algo\lyra2re.c" />
<ClCompile Include="algo\s3.c" />
<ClCompile Include="algo\blake.c" />
<ClCompile Include="algo\cryptonight.c" />
<ClCompile Include="algo\fresh.c" />
<ClCompile Include="algo\groestl.c" />
<ClCompile Include="algo\heavy.c" />
<ClCompile Include="algo\keccak.c" />
<ClCompile Include="algo\neoscrypt.c" />
<ClCompile Include="algo\nist5.c" />
<ClCompile Include="algo\pentablake.c" />
<ClCompile Include="algo\quark.c" />
<ClCompile Include="algo\qubit.c" />
<ClCompile Include="algo\sha2.c" />
<ClCompile Include="algo\scrypt.c">
<Optimization Condition="'$(Configuration)'=='Release'">Full</Optimization>
</ClCompile>
<ClCompile Include="skein.c" />
<ClCompile Include="x11.c" />
<ClCompile Include="x13.c" />
<ClCompile Include="x14.c" />
<ClCompile Include="x15.c" />
<ClCompile Include="algo\skein.c" />
<ClCompile Include="algo\x11.c" />
<ClCompile Include="algo\x13.c" />
<ClCompile Include="algo\x14.c" />
<ClCompile Include="algo\x15.c" />
<ClCompile Include="sha3\aes_helper.c">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</ClCompile>
Expand Down Expand Up @@ -305,28 +306,28 @@
<ClInclude Include="sha3\sph_whirlpool.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="neoscrypt_asm.S">
<ClCompile Include="asm\neoscrypt_asm.S">
</ClCompile>
<ClCompile Include="aesb-x86.SS">
<ClCompile Include="asm\aesb-x86.SS">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="scrypt-x86.S">
<ClCompile Include="asm\scrypt-x86.S">
<ExcludedFromBuild Condition="'$(Platform)'=='x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sha2-x86.S">
<ClCompile Include="asm\sha2-x86.S">
<ExcludedFromBuild Condition="'$(Platform)'=='x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="aesb-x64.S">
<ClCompile Include="asm\aesb-x64.S">
<ExcludedFromBuild>true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="scrypt-x64.S">
<ClCompile Include="asm\scrypt-x64.S">
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="sha2-x64.S">
<ClCompile Include="asm\sha2-x64.S">
<ExcludedFromBuild Condition="'$(Platform)'=='Win32'">true</ExcludedFromBuild>
</ClCompile>
<None Include="scrypt-arm.S" />
<None Include="sha2-arm.S" />
<None Include="asm\scrypt-arm.S" />
<None Include="asm\sha2-arm.S" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<!-- Copy the required dlls -->
Expand Down
Loading

0 comments on commit ba2fbc7

Please sign in to comment.