Browse Source

gostd added

windows
orignal 7 years ago
parent
commit
dcf9769ff2
  1. 6
      cpu-miner.c
  2. 25
      cpuminer-config.h
  3. 31
      gost.c
  4. 3
      miner.h

6
cpu-miner.c

@ -105,6 +105,7 @@ enum sha256_algos { @@ -105,6 +105,7 @@ enum sha256_algos {
ALGO_SHA256D, /* SHA-256d */
ALGO_QUARK,
ALGO_X,
ALGO_GOSTD
};
static const char *algo_names[] = {
@ -112,6 +113,7 @@ static const char *algo_names[] = { @@ -112,6 +113,7 @@ static const char *algo_names[] = {
[ALGO_SHA256D] = "sha256d",
[ALGO_QUARK] = "quark",
[ALGO_X] = "X11",
[ALGO_GOSTD] = "gostd",
};
bool opt_hashdebug = false;
@ -796,6 +798,10 @@ static void *miner_thread(void *userdata) @@ -796,6 +798,10 @@ static void *miner_thread(void *userdata)
rc = scanhash_X(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;
case ALGO_GOSTD:
rc = scanhash_gostd(thr_id, work.data, work.target,
max_nonce, &hashes_done);
break;
default:
/* should never happen */
goto out;

25
cpuminer-config.h

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
/* #undef HAVE_ALLOCA_H */
#define HAVE_ALLOCA_H 1
/* Define to 1 if you have the declaration of `be32dec', and to 0 if you
don't. */
@ -57,7 +57,7 @@ @@ -57,7 +57,7 @@
#define HAVE_STRING_H 1
/* Define to 1 if you have the <syslog.h> header file. */
/* #undef HAVE_SYSLOG_H */
#define HAVE_SYSLOG_H 1
/* Define to 1 if you have the <sys/endian.h> header file. */
/* #undef HAVE_SYS_ENDIAN_H */
@ -69,7 +69,7 @@ @@ -69,7 +69,7 @@
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
/* #undef HAVE_SYS_SYSCTL_H */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
@ -78,25 +78,25 @@ @@ -78,25 +78,25 @@
#define HAVE_UNISTD_H 1
/* Defined if libcurl supports AsynchDNS */
/* #undef LIBCURL_FEATURE_ASYNCHDNS */
#define LIBCURL_FEATURE_ASYNCHDNS 1
/* Defined if libcurl supports IDN */
/* #undef LIBCURL_FEATURE_IDN */
#define LIBCURL_FEATURE_IDN 1
/* Defined if libcurl supports IPv6 */
/* #undef LIBCURL_FEATURE_IPV6 */
#define LIBCURL_FEATURE_IPV6 1
/* Defined if libcurl supports KRB4 */
/* #undef LIBCURL_FEATURE_KRB4 */
/* Defined if libcurl supports libz */
/* #undef LIBCURL_FEATURE_LIBZ */
#define LIBCURL_FEATURE_LIBZ 1
/* Defined if libcurl supports NTLM */
/* #undef LIBCURL_FEATURE_NTLM */
#define LIBCURL_FEATURE_NTLM 1
/* Defined if libcurl supports SSL */
/* #undef LIBCURL_FEATURE_SSL */
#define LIBCURL_FEATURE_SSL 1
/* Defined if libcurl supports SSPI */
/* #undef LIBCURL_FEATURE_SSPI */
@ -111,13 +111,13 @@ @@ -111,13 +111,13 @@
#define LIBCURL_PROTOCOL_FTP 1
/* Defined if libcurl supports FTPS */
/* #undef LIBCURL_PROTOCOL_FTPS */
#define LIBCURL_PROTOCOL_FTPS 1
/* Defined if libcurl supports HTTP */
#define LIBCURL_PROTOCOL_HTTP 1
/* Defined if libcurl supports HTTPS */
/* #undef LIBCURL_PROTOCOL_HTTPS */
#define LIBCURL_PROTOCOL_HTTPS 1
/* Defined if libcurl supports IMAP */
#define LIBCURL_PROTOCOL_IMAP 1
@ -140,9 +140,6 @@ @@ -140,9 +140,6 @@
/* Defined if libcurl supports TFTP */
#define LIBCURL_PROTOCOL_TFTP 1
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of package */
#define PACKAGE "cpuminer"

31
gost.c

@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
#include <memory.h>
#include <math.h>
#include "miner.h"
#include "sph_gost.h"
#ifdef __cplusplus
@ -1095,6 +1096,36 @@ sph_gost512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) @@ -1095,6 +1096,36 @@ sph_gost512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
//gost_close64(cc, ub, n, dst);
}
int scanhash_gostd(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, unsigned long *hashes_done)
{
uint32_t data[80] __attribute__((aligned(128)));
uint32_t hash[8] __attribute__((aligned(32)));
uint32_t digest[16] __attribute__((aligned(64)));
uint32_t n = pdata[19] - 1;
const uint32_t first_nonce = pdata[19];
const uint32_t Htarg = ptarget[7];
memcpy(data, pdata, 80);
do
{
data[3] = ++n;
sph_gost512 (digest, data, 80);
sph_gost256 (hash, digest, 64);
if (swab32(hash[7]) <= Htarg)
{
pdata[19] = data[3];
*hashes_done = n - first_nonce + 1;
return 1;
}
} while (n < max_nonce && !work_restart[thr_id].restart);
*hashes_done = n - first_nonce + 1;
pdata[19] = n;
return 0;
}
#ifdef __cplusplus
}

3
miner.h

@ -151,6 +151,9 @@ void sha256_transform_8way(uint32_t *state, const uint32_t *block, int swap); @@ -151,6 +151,9 @@ void sha256_transform_8way(uint32_t *state, const uint32_t *block, int swap);
extern int scanhash_sha256d(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_gostd(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done);
extern int scanhash_quark(int thr_id, uint32_t *pdata,
const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done);

Loading…
Cancel
Save