Skip to content

Commit

Permalink
alternative verifier for json cuckoo_solution format
Browse files Browse the repository at this point in the history
  • Loading branch information
tromp committed Dec 17, 2020
1 parent b305449 commit ae42301
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/cuckatoo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ verify19: ../crypto/siphash.hpp cuckatoo.h cuckatoo.c simple.cpp Makefile
verify32: ../crypto/siphash.hpp cuckatoo.h cuckatoo.c simple.cpp Makefile
$(GPP) -o $@ -DPROOFSIZE=42 -DEDGEBITS=32 cuckatoo.c $(BLAKE_2B_SRC)

verify32_: ../crypto/siphash.hpp cuckatoo.h cuckatoo.c simple.cpp Makefile
$(GPP) -o $@ -Dcuckoo_solution -DPROOFSIZE=42 -DEDGEBITS=32 cuckatoo.c $(BLAKE_2B_SRC)

simple29: ../crypto/siphash.hpp cuckatoo.h bitmap.hpp graph.hpp simple.cpp Makefile
$(GPP) -o $@ -DPROOFSIZE=42 -DEDGEBITS=29 simple.cpp $(BLAKE_2B_SRC)

Expand Down
15 changes: 10 additions & 5 deletions src/cuckatoo/cuckatoo.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ int main(int argc, char **argv) {
assert(len == sizeof(headernonce)-sizeof(u64) || len == sizeof(headernonce));
for (u32 i=0; i<len; i++) {
sscanf(optarg+2*i, "%2hhx", headernonce+i);
printf("%d %0xx\n", i, headernonce[i]);
}
break;
case 'n':
Expand All @@ -46,13 +45,19 @@ int main(int argc, char **argv) {
if (nonce) print_log(",%d", nonce);
print_log(")\n");

word_t nonces[PROOFSIZE];
uint64_t index;
#ifdef cuckoo_solution
for (int nsols=0; scanf(" \"cuckoo_solution\": [") == 0; nsols++) {
for (int n = 0; n < PROOFSIZE; n++) {
int nscan = scanf(" %" SCNu64 ",", &index);
#else
for (int nsols=0; scanf(" Solution") == 0; nsols++) {
word_t nonces[PROOFSIZE];
for (int n = 0; n < PROOFSIZE; n++) {
uint64_t nonce;
int nscan = scanf(" %" SCNx64, &nonce);
int nscan = scanf(" %" SCNx64, &index);
#endif
assert(nscan == 1);
nonces[n] = nonce;
nonces[n] = index;
}
int pow_rc = verify(nonces, &keys);
if (pow_rc == POW_OK) {
Expand Down

0 comments on commit ae42301

Please sign in to comment.