1
2
3
4
5
6
7
8
9
10
11
12
13
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
+
+
+
|
#include <stdint.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <tcl.h>
#ifdef NANO_TCL_HAVE_OPENMP
# include <omp.h>
#endif
#include "randombytes.h"
#include "tweetnacl.h"
#include "blake2.h"
#define NANO_SECRET_KEY_LENGTH (crypto_sign_SECRETKEYBYTES - crypto_sign_PUBLICKEYBYTES)
#define NANO_PUBLIC_KEY_LENGTH (crypto_sign_PUBLICKEYBYTES)
|
412
413
414
415
416
417
418
419
420
421
422
423
424
425
|
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
|
+
|
static void nano_generate_work(const unsigned char *blockhash, unsigned char *workOut, uint64_t workMin) {
unsigned char work[NANO_WORK_VALUE_LENGTH];
unsigned int offset;
int work_valid;
memcpy(work, blockhash, sizeof(work));
#pragma omp target
while (1) {
work_valid = nano_validate_work(blockhash, work, workMin);
if (work_valid) {
break;
}
offset = 0;
|