Skip to content

Instantly share code, notes, and snippets.

@bitzeny
Created November 9, 2014 13:45
Show Gist options
  • Save bitzeny/bf941cae89a18d95f92c to your computer and use it in GitHub Desktop.
Save bitzeny/bf941cae89a18d95f92c to your computer and use it in GitHub Desktop.
diff --git a/cpu-miner.c b/cpu-miner.c
index e46b37e..9ecdeb3 100644
--- a/cpu-miner.c
+++ b/cpu-miner.c
@@ -1051,7 +1051,7 @@ static void stratum_gen_work(struct stratum_ctx *sctx, struct work *w
free(xnonce2str);
}
- if (opt_algo == ALGO_SCRYPT)
+ if (opt_algo == ALGO_SCRYPT || opt_algo == ALGO_YESCRYPT)
diff_to_target(work->target, sctx->job.diff / 65536.0);
else
diff_to_target(work->target, sctx->job.diff);
diff --git a/yescrypt.c b/yescrypt.c
index 10546ce..59f22f9 100644
--- a/yescrypt.c
+++ b/yescrypt.c
@@ -87,6 +87,7 @@ static int pretest(const uint32_t *hash, const uint32_t *target)
return hash[7] < target[7];
}
+#include <stdio.h>
int scanhash_yescrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget,
uint32_t max_nonce, unsigned long *hashes_done)
{
@@ -103,6 +104,10 @@ int scanhash_yescrypt(int thr_id, uint32_t *pdata, const uint32_t *pta
yescrypt_hash((char *)data, (char *)hash);
if (pretest(hash, ptarget) && fulltest(hash, ptarget)) {
pdata[19] = n;
+ for (int j = 0; j < 8; j++) {
+ printf("%08x", hash[7-j]);
+ }
+ printf("\n");
*hashes_done = n - first_nonce + 1;
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment