-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,850 additions
and
200 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
#include "common.h" | ||
#include <string.h> | ||
|
||
void write_seed(char seed[32], uint64_t numeric_id) { | ||
numeric_id = bswap_64(numeric_id); | ||
memmove(&seed[0], &numeric_id, 8); | ||
memset(&seed[8], 0, 8); | ||
seed[16] = -128; // shabal message termination bit | ||
memset(&seed[17], 0, 15); | ||
} | ||
|
||
void write_term(char term[32]) { | ||
term[0] = -128; // shabal message termination bit | ||
memset(&term[1], 0, 31); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,65 @@ | ||
#include <stdint.h> | ||
|
||
#pragma once | ||
|
||
#ifdef _MSC_VER | ||
|
||
#include <stdlib.h> | ||
#define bswap_32(x) _byteswap_ulong(x) | ||
#define bswap_64(x) _byteswap_uint64(x) | ||
|
||
#elif defined(__APPLE__) | ||
|
||
// Mac OS X / Darwin features | ||
#include <libkern/OSByteOrder.h> | ||
#define bswap_32(x) OSSwapInt32(x) | ||
#define bswap_64(x) OSSwapInt64(x) | ||
|
||
#elif defined(__sun) || defined(sun) | ||
|
||
#include <sys/byteorder.h> | ||
#define bswap_32(x) BSWAP_32(x) | ||
#define bswap_64(x) BSWAP_64(x) | ||
|
||
#elif defined(__FreeBSD__) | ||
|
||
#include <sys/endian.h> | ||
#define bswap_32(x) bswap32(x) | ||
#define bswap_64(x) bswap64(x) | ||
|
||
#elif defined(__OpenBSD__) | ||
|
||
#include <sys/types.h> | ||
#define bswap_32(x) swap32(x) | ||
#define bswap_64(x) swap64(x) | ||
|
||
#elif defined(__NetBSD__) | ||
|
||
#include <machine/bswap.h> | ||
#include <sys/types.h> | ||
#if defined(__BSWAP_RENAME) && !defined(__bswap_32) | ||
#define bswap_32(x) bswap32(x) | ||
#define bswap_64(x) bswap64(x) | ||
#endif | ||
|
||
#else | ||
|
||
#include <byteswap.h> | ||
|
||
#endif | ||
|
||
#define HASH_SIZE 32 | ||
#define HASH_CAP 4096 | ||
#define NUM_SCOOPS 4096 | ||
#define SCOOP_SIZE 64 | ||
#define NONCE_SIZE (HASH_CAP * SCOOP_SIZE) // 4096*64 | ||
|
||
void write_seed(char seed[32], uint64_t numeric_id); | ||
|
||
void write_term(char term[32]); | ||
|
||
#define SET_BEST_DEADLINE(d, o) \ | ||
if ((d) < *best_deadline) { \ | ||
*best_deadline = (d); \ | ||
*best_offset = (o); \ | ||
} | ||
|
||
void write_term(char term[32]); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.