mirror of
https://github.com/JayDDee/cpuminer-opt.git
synced 2025-09-17 23:44:27 +00:00
v3.5.2
This commit is contained in:
@@ -122,6 +122,7 @@ cpuminer_SOURCES = \
|
|||||||
algo/skein/skein2.c \
|
algo/skein/skein2.c \
|
||||||
algo/s3.c \
|
algo/s3.c \
|
||||||
algo/tiger/sph_tiger.c \
|
algo/tiger/sph_tiger.c \
|
||||||
|
algo/timetravel.c \
|
||||||
algo/veltor.c \
|
algo/veltor.c \
|
||||||
algo/whirlpool/whirlpool.c \
|
algo/whirlpool/whirlpool.c \
|
||||||
algo/whirlpool/whirlpoolx.c \
|
algo/whirlpool/whirlpoolx.c \
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
Change Log
|
Change Log
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
V3.5.2
|
||||||
|
|
||||||
|
Timetrave (machinecoin) added and optimized.
|
||||||
|
|
||||||
v3.5.1
|
v3.5.1
|
||||||
|
|
||||||
Bastion 9% faster with AES, benchkmark still not working.
|
Bastion 9% faster with AES, benchkmark still not working.
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ bool register_algo_gate( int algo, algo_gate_t *gate )
|
|||||||
case ALGO_SKEIN: register_skein_algo ( gate ); break;
|
case ALGO_SKEIN: register_skein_algo ( gate ); break;
|
||||||
case ALGO_SKEIN2: register_skein2_algo ( gate ); break;
|
case ALGO_SKEIN2: register_skein2_algo ( gate ); break;
|
||||||
case ALGO_S3: register_s3_algo ( gate ); break;
|
case ALGO_S3: register_s3_algo ( gate ); break;
|
||||||
|
case ALGO_TIMETRAVEL: register_timetravel_algo ( gate ); break;
|
||||||
case ALGO_VANILLA: register_vanilla_algo ( gate ); break;
|
case ALGO_VANILLA: register_vanilla_algo ( gate ); break;
|
||||||
case ALGO_VELTOR: register_veltor_algo ( gate ); break;
|
case ALGO_VELTOR: register_veltor_algo ( gate ); break;
|
||||||
case ALGO_WHIRLPOOL: register_whirlpool_algo ( gate ); break;
|
case ALGO_WHIRLPOOL: register_whirlpool_algo ( gate ); break;
|
||||||
|
|||||||
@@ -139,6 +139,8 @@ HashReturn_gr reinit_groestl(hashState_groestl* ctx)
|
|||||||
/* set other variables */
|
/* set other variables */
|
||||||
ctx->buf_ptr = 0;
|
ctx->buf_ptr = 0;
|
||||||
ctx->block_counter = 0;
|
ctx->block_counter = 0;
|
||||||
|
|
||||||
|
// not used
|
||||||
ctx->bits_in_last_byte = 0;
|
ctx->bits_in_last_byte = 0;
|
||||||
|
|
||||||
return SUCCESS_GR;
|
return SUCCESS_GR;
|
||||||
@@ -149,9 +151,16 @@ HashReturn_gr reinit_groestl(hashState_groestl* ctx)
|
|||||||
HashReturn_gr update_groestl(hashState_groestl* ctx,
|
HashReturn_gr update_groestl(hashState_groestl* ctx,
|
||||||
const BitSequence_gr* input,
|
const BitSequence_gr* input,
|
||||||
DataLength_gr databitlen) {
|
DataLength_gr databitlen) {
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
int msglen = (int)(databitlen/8);
|
int msglen = (int)(databitlen/8);
|
||||||
int rem = (int)(databitlen%8);
|
int rem = (int)(databitlen%8); // not used
|
||||||
|
|
||||||
|
// The only data length used is either 64 bytes (512 bits,
|
||||||
|
// or 80 bytes (640 bits). The sph version of groestl used a byte
|
||||||
|
// size for the data length, so odd bits aren't supported there.
|
||||||
|
// No need to support them here either, change the arg to bytes
|
||||||
|
// for consistency.
|
||||||
|
|
||||||
/* non-integral number of message bytes can only be supplied in the
|
/* non-integral number of message bytes can only be supplied in the
|
||||||
last call to this function */
|
last call to this function */
|
||||||
@@ -160,6 +169,8 @@ HashReturn_gr update_groestl(hashState_groestl* ctx,
|
|||||||
/* if the buffer contains data that has not yet been digested, first
|
/* if the buffer contains data that has not yet been digested, first
|
||||||
add data to buffer until full */
|
add data to buffer until full */
|
||||||
|
|
||||||
|
//// This code can never run, it is indeed dead. buf_ptr is initialized
|
||||||
|
//// to 0 in init_groestl and hasn't been changed yet
|
||||||
// The following block of code never gets hit when hashing x11 or quark
|
// The following block of code never gets hit when hashing x11 or quark
|
||||||
// leave it here in case it might be needed.
|
// leave it here in case it might be needed.
|
||||||
// if (ctx->buf_ptr)
|
// if (ctx->buf_ptr)
|
||||||
@@ -187,6 +198,10 @@ HashReturn_gr update_groestl(hashState_groestl* ctx,
|
|||||||
|
|
||||||
/* digest bulk of message */
|
/* digest bulk of message */
|
||||||
Transform(ctx, input+index, msglen-index);
|
Transform(ctx, input+index, msglen-index);
|
||||||
|
|
||||||
|
// index is always zero here, the following line sets it == msglen
|
||||||
|
// meaning the next while test will always fail. it's all part of
|
||||||
|
// supporting odd bits.
|
||||||
index += ((msglen-index)/ctx->statesize)*ctx->statesize;
|
index += ((msglen-index)/ctx->statesize)*ctx->statesize;
|
||||||
|
|
||||||
/* store remaining data in buffer */
|
/* store remaining data in buffer */
|
||||||
@@ -194,7 +209,11 @@ HashReturn_gr update_groestl(hashState_groestl* ctx,
|
|||||||
{
|
{
|
||||||
ctx->buffer[(int)ctx->buf_ptr++] = input[index++];
|
ctx->buffer[(int)ctx->buf_ptr++] = input[index++];
|
||||||
}
|
}
|
||||||
|
// buf_ptr should be msglen now.
|
||||||
|
|
||||||
|
//// This code isn't quite dead but but would only run if datalen
|
||||||
|
/// is not a multiple of 8. As a result bits_in_last_byte is never
|
||||||
|
//// modified from its initial zero.
|
||||||
// Another block that doesn't get used by x11 or quark
|
// Another block that doesn't get used by x11 or quark
|
||||||
// /* if non-integral number of bytes have been supplied, store
|
// /* if non-integral number of bytes have been supplied, store
|
||||||
// remaining bits in last byte, together with information about
|
// remaining bits in last byte, together with information about
|
||||||
@@ -223,8 +242,13 @@ HashReturn_gr final_groestl(hashState_groestl* ctx,
|
|||||||
ctx->buffer[(int)ctx->buf_ptr-1] ^= 0x1<<(7-BILB);
|
ctx->buffer[(int)ctx->buf_ptr-1] ^= 0x1<<(7-BILB);
|
||||||
BILB = 0;
|
BILB = 0;
|
||||||
}
|
}
|
||||||
|
//This sets the first pad byte
|
||||||
else ctx->buffer[(int)ctx->buf_ptr++] = 0x80;
|
else ctx->buffer[(int)ctx->buf_ptr++] = 0x80;
|
||||||
|
|
||||||
|
// buf_ptr is left == msglen after update_groestl, 64 (bytes).
|
||||||
|
// It has now been incrememnted to 65. The test below should fail
|
||||||
|
// with 64 and 80 and require 1 pad block. Why does 64 bit need a pad block?
|
||||||
|
// length padding?
|
||||||
/* pad with '0'-bits */
|
/* pad with '0'-bits */
|
||||||
if (ctx->buf_ptr > ctx->statesize-LENGTHFIELDLEN) {
|
if (ctx->buf_ptr > ctx->statesize-LENGTHFIELDLEN) {
|
||||||
/* padding requires two blocks */
|
/* padding requires two blocks */
|
||||||
@@ -235,6 +259,19 @@ HashReturn_gr final_groestl(hashState_groestl* ctx,
|
|||||||
Transform(ctx, ctx->buffer, ctx->statesize);
|
Transform(ctx, ctx->buffer, ctx->statesize);
|
||||||
ctx->buf_ptr = 0;
|
ctx->buf_ptr = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the padding can be vectorized, including the first pad byte above
|
||||||
|
// 64 bit: buffer[64..79] = {0x80000000,0,0,0}
|
||||||
|
// buffer[80..95] = {0,0,0,0}
|
||||||
|
// buffer[96..111] = {0,0,0,0}
|
||||||
|
// buffer[112..128 = {0,0,length padding}
|
||||||
|
// 80 bit: buffer[64..79] = unchanged
|
||||||
|
// buffer[80..95] = {0x800000000,0,0,0}
|
||||||
|
// buffer[96..111] = {0,0,0,0}
|
||||||
|
// buffer[112..128 = {0,0,length padding}
|
||||||
|
|
||||||
|
|
||||||
|
// this will pad up to 120 bytes
|
||||||
while (ctx->buf_ptr < ctx->statesize-LENGTHFIELDLEN) {
|
while (ctx->buf_ptr < ctx->statesize-LENGTHFIELDLEN) {
|
||||||
ctx->buffer[(int)ctx->buf_ptr++] = 0;
|
ctx->buffer[(int)ctx->buf_ptr++] = 0;
|
||||||
}
|
}
|
||||||
@@ -257,6 +294,7 @@ HashReturn_gr final_groestl(hashState_groestl* ctx,
|
|||||||
output[j] = s[i];
|
output[j] = s[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the following is redundant as init_groestl will reset to zero.
|
||||||
/* zeroise relevant variables and deallocate memory */
|
/* zeroise relevant variables and deallocate memory */
|
||||||
|
|
||||||
for (i = 0; i < ctx->columns; i++) {
|
for (i = 0; i < ctx->columns; i++) {
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ typedef unsigned char BitSequence_gr;
|
|||||||
typedef unsigned long long DataLength_gr;
|
typedef unsigned long long DataLength_gr;
|
||||||
typedef enum { SUCCESS_GR = 0, FAIL_GR = 1, BAD_HASHBITLEN_GR = 2} HashReturn_gr;
|
typedef enum { SUCCESS_GR = 0, FAIL_GR = 1, BAD_HASHBITLEN_GR = 2} HashReturn_gr;
|
||||||
|
|
||||||
|
// Use area128 overlay for buffer to facilitate fast copying
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
__attribute__ ((aligned (32))) u64 chaining[SIZE/8]; /* actual state */
|
__attribute__ ((aligned (32))) u64 chaining[SIZE/8]; /* actual state */
|
||||||
__attribute__ ((aligned (32))) BitSequence_gr buffer[SIZE]; /* data buffer */
|
__attribute__ ((aligned (32))) BitSequence_gr buffer[SIZE]; /* data buffer */
|
||||||
|
|||||||
292
algo/timetravel.c
Normal file
292
algo/timetravel.c
Normal file
@@ -0,0 +1,292 @@
|
|||||||
|
#include <miner.h>
|
||||||
|
#include "algo-gate-api.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "algo/blake/sph_blake.h"
|
||||||
|
#include "algo/bmw/sph_bmw.h"
|
||||||
|
#include "algo/jh/sph_jh.h"
|
||||||
|
#include "algo/keccak/sph_keccak.h"
|
||||||
|
#include "algo/skein/sph_skein.h"
|
||||||
|
#include "algo/luffa/sph_luffa.h"
|
||||||
|
#include "algo/luffa/sse2/luffa_for_sse2.h"
|
||||||
|
#include "algo/cubehash/sse2/cubehash_sse2.h"
|
||||||
|
|
||||||
|
#ifdef NO_AES_NI
|
||||||
|
#include "algo/groestl/sph_groestl.h"
|
||||||
|
#else
|
||||||
|
#include "algo/groestl/aes_ni/hash-groestl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Machinecoin Genesis Timestamp
|
||||||
|
#define HASH_FUNC_BASE_TIMESTAMP 1389040865
|
||||||
|
|
||||||
|
#define HASH_FUNC_COUNT 8
|
||||||
|
#define HASH_FUNC_COUNT_PERMUTATIONS 40320
|
||||||
|
|
||||||
|
//static int permutation[HASH_FUNC_COUNT] = { 0 };
|
||||||
|
static __thread uint32_t s_ntime = UINT32_MAX;
|
||||||
|
static __thread int permutation[HASH_FUNC_COUNT] = { 0 };
|
||||||
|
|
||||||
|
inline void reverse( int *pbegin, int *pend )
|
||||||
|
{
|
||||||
|
while ( (pbegin != pend) && (pbegin != --pend) )
|
||||||
|
{
|
||||||
|
swap_vars( *pbegin, *pend );
|
||||||
|
pbegin++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void next_permutation( int *pbegin, int *pend )
|
||||||
|
{
|
||||||
|
if ( pbegin == pend )
|
||||||
|
return;
|
||||||
|
|
||||||
|
int *i = pbegin;
|
||||||
|
++i;
|
||||||
|
if ( i == pend )
|
||||||
|
return;
|
||||||
|
|
||||||
|
i = pend;
|
||||||
|
--i;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
int *j = i;
|
||||||
|
--i;
|
||||||
|
|
||||||
|
if ( *i < *j )
|
||||||
|
{
|
||||||
|
int *k = pend;
|
||||||
|
|
||||||
|
while ( !(*i < *--k) ) /* do nothing */ ;
|
||||||
|
|
||||||
|
swap_vars( *i, *k );
|
||||||
|
reverse(j, pend);
|
||||||
|
return; // true
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( i == pbegin )
|
||||||
|
{
|
||||||
|
reverse(pbegin, pend);
|
||||||
|
return; // false
|
||||||
|
}
|
||||||
|
// else?
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
sph_blake512_context blake;
|
||||||
|
sph_bmw512_context bmw;
|
||||||
|
sph_skein512_context skein;
|
||||||
|
sph_jh512_context jh;
|
||||||
|
sph_keccak512_context keccak;
|
||||||
|
sph_luffa512_context luffa;
|
||||||
|
// hashState_luffa luffa;
|
||||||
|
cubehashParam cube;
|
||||||
|
// ctx optimization doesn't work for groestl, do it the old way
|
||||||
|
//#ifdef NO_AES_NI
|
||||||
|
// sph_groestl512_context groestl;
|
||||||
|
//#else
|
||||||
|
// hashState_groestl groestl;
|
||||||
|
//#endif
|
||||||
|
} tt_ctx_holder;
|
||||||
|
|
||||||
|
tt_ctx_holder tt_ctx;
|
||||||
|
|
||||||
|
void init_tt_ctx()
|
||||||
|
{
|
||||||
|
sph_blake512_init( &tt_ctx.blake );
|
||||||
|
sph_bmw512_init( &tt_ctx.bmw );
|
||||||
|
sph_skein512_init( &tt_ctx.skein );
|
||||||
|
sph_jh512_init( &tt_ctx.jh );
|
||||||
|
sph_keccak512_init( &tt_ctx.keccak );
|
||||||
|
sph_luffa512_init( &tt_ctx.luffa );
|
||||||
|
// init_luffa( &tt_ctx.luffa, 512 );
|
||||||
|
cubehashInit( &tt_ctx.cube, 512, 16, 32 );
|
||||||
|
//#ifdef NO_AES_NI
|
||||||
|
// sph_groestl512_init( &tt_ctx.groestl );
|
||||||
|
//#else
|
||||||
|
// init_groestl( &tt_ctx.groestl );
|
||||||
|
//#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
void timetravel_hash(void *output, const void *input)
|
||||||
|
{
|
||||||
|
uint32_t _ALIGN(64) hash[128]; // 16 bytes * HASH_FUNC_COUNT
|
||||||
|
uint32_t *hashA, *hashB;
|
||||||
|
uint32_t dataLen = 64;
|
||||||
|
uint32_t *work_data = (uint32_t *)input;
|
||||||
|
const uint32_t timestamp = work_data[17];
|
||||||
|
tt_ctx_holder ctx;
|
||||||
|
memcpy( &ctx, &tt_ctx, sizeof(tt_ctx) );
|
||||||
|
int i;
|
||||||
|
|
||||||
|
// workaround for initializing groestl ctx
|
||||||
|
#ifdef NO_AES_NI
|
||||||
|
sph_groestl512_context ctx_groestl;
|
||||||
|
#else
|
||||||
|
hashState_groestl ctx_groestl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for ( i = 0; i < HASH_FUNC_COUNT; i++ )
|
||||||
|
{
|
||||||
|
if (i == 0)
|
||||||
|
{
|
||||||
|
dataLen = 80;
|
||||||
|
hashA = work_data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dataLen = 64;
|
||||||
|
hashA = &hash[16 * (i - 1)];
|
||||||
|
}
|
||||||
|
hashB = &hash[16 * i];
|
||||||
|
|
||||||
|
switch ( permutation[i] )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
// sph_blake512_init( &ctx.blake );
|
||||||
|
sph_blake512( &ctx.blake, hashA, dataLen );
|
||||||
|
sph_blake512_close( &ctx.blake, hashB );
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
// sph_bmw512_init( &ctx.bmw );
|
||||||
|
sph_bmw512( &ctx.bmw, hashA, dataLen );
|
||||||
|
sph_bmw512_close( &ctx.bmw, hashB );
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
#ifdef NO_AES_NI
|
||||||
|
sph_groestl512_init( &ctx_groestl );
|
||||||
|
sph_groestl512( &ctx_groestl, hashA, dataLen );
|
||||||
|
sph_groestl512_close( &ctx_groestl, hashB );
|
||||||
|
#else
|
||||||
|
init_groestl( &ctx_groestl );
|
||||||
|
update_groestl( &ctx_groestl, (char*)hashA, dataLen*8 );
|
||||||
|
final_groestl( &ctx_groestl, (char*)hashB );
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// sph_skein512_init( &ctx.skein );
|
||||||
|
sph_skein512( &ctx.skein, hashA, dataLen );
|
||||||
|
sph_skein512_close( &ctx.skein, hashB );
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// sph_jh512_init( &ctx.jh );
|
||||||
|
sph_jh512( &ctx.jh, hashA, dataLen );
|
||||||
|
sph_jh512_close( &ctx.jh, hashB);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
// sph_keccak512_init( &ctx.keccak );
|
||||||
|
sph_keccak512( &ctx.keccak, hashA, dataLen );
|
||||||
|
sph_keccak512_close( &ctx.keccak, hashB );
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
// sph_luffa512_init( &ctx.luffa );
|
||||||
|
sph_luffa512 ( &ctx.luffa, hashA, dataLen );
|
||||||
|
sph_luffa512_close( &ctx.luffa, hashB );
|
||||||
|
// init_luffa( &ctx.luffa, 512 );
|
||||||
|
// update_luffa( &ctx.luffa, (const BitSequence*)hashA, dataLen*8 );
|
||||||
|
// final_luffa( &ctx.luffa, (BitSequence*)hashB );
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
// cubehashInit( &ctx.cube, 512, 16, 32 );
|
||||||
|
cubehashUpdate( &ctx.cube, (const byte*) hashA, dataLen );
|
||||||
|
cubehashDigest( &ctx.cube, (byte*)hashB );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy(output, &hash[16 * (HASH_FUNC_COUNT - 1)], 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
int scanhash_timetravel( int thr_id, struct work *work, uint32_t max_nonce,
|
||||||
|
uint64_t *hashes_done )
|
||||||
|
{
|
||||||
|
uint32_t _ALIGN(64) hash[8];
|
||||||
|
uint32_t _ALIGN(64) endiandata[20];
|
||||||
|
uint32_t *pdata = work->data;
|
||||||
|
uint32_t *ptarget = work->target;
|
||||||
|
|
||||||
|
const uint32_t Htarg = ptarget[7];
|
||||||
|
const uint32_t first_nonce = pdata[19];
|
||||||
|
uint32_t nonce = first_nonce;
|
||||||
|
volatile uint8_t *restart = &(work_restart[thr_id].restart);
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (opt_benchmark)
|
||||||
|
ptarget[7] = 0x0cff;
|
||||||
|
|
||||||
|
for (int k=0; k < 19; k++)
|
||||||
|
be32enc(&endiandata[k], pdata[k]);
|
||||||
|
|
||||||
|
const uint32_t timestamp = endiandata[17];
|
||||||
|
if ( timestamp != s_ntime )
|
||||||
|
{
|
||||||
|
const int steps = ( timestamp - HASH_FUNC_BASE_TIMESTAMP )
|
||||||
|
% HASH_FUNC_COUNT_PERMUTATIONS;
|
||||||
|
for ( i = 0; i < HASH_FUNC_COUNT; i++ )
|
||||||
|
permutation[i] = i;
|
||||||
|
for ( i = 0; i < steps; i++ )
|
||||||
|
next_permutation( permutation, permutation + HASH_FUNC_COUNT );
|
||||||
|
s_ntime = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
be32enc(&endiandata[19], nonce);
|
||||||
|
timetravel_hash(hash, endiandata);
|
||||||
|
|
||||||
|
if (hash[7] <= Htarg && fulltest(hash, ptarget)) {
|
||||||
|
work_set_target_ratio(work, hash);
|
||||||
|
pdata[19] = nonce;
|
||||||
|
*hashes_done = pdata[19] - first_nonce;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
nonce++;
|
||||||
|
|
||||||
|
} while (nonce < max_nonce && !(*restart));
|
||||||
|
|
||||||
|
pdata[19] = nonce;
|
||||||
|
*hashes_done = pdata[19] - first_nonce + 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void timetravel_set_target( struct work* work, double job_diff )
|
||||||
|
{
|
||||||
|
work_set_target( work, job_diff / (256.0 * opt_diff_factor) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// set_data_endian is a reasonable gate to use, it's called upon receipt
|
||||||
|
// of new work (new ntime) and has the right arg to access it.
|
||||||
|
void timetravel_calc_perm( struct work *work )
|
||||||
|
{
|
||||||
|
// We want to permute algorithms. To get started we
|
||||||
|
// initialize an array with a sorted sequence of unique
|
||||||
|
// integers where every integer represents its own algorithm.
|
||||||
|
int ntime, steps, i;
|
||||||
|
be32enc( &ntime, work->data[ STD_NTIME_INDEX ] );
|
||||||
|
steps = ( ntime - HASH_FUNC_BASE_TIMESTAMP )
|
||||||
|
% HASH_FUNC_COUNT_PERMUTATIONS;
|
||||||
|
for ( i = 0; i < HASH_FUNC_COUNT; i++ )
|
||||||
|
permutation[i] = i;
|
||||||
|
for ( i = 0; i < steps; i++ )
|
||||||
|
next_permutation( permutation, permutation + HASH_FUNC_COUNT );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool register_timetravel_algo( algo_gate_t* gate )
|
||||||
|
{
|
||||||
|
gate->optimizations = SSE2_OPT | AES_OPT | AVX_OPT | AVX2_OPT;
|
||||||
|
init_tt_ctx();
|
||||||
|
gate->scanhash = (void*)&scanhash_timetravel;
|
||||||
|
gate->hash = (void*)&timetravel_hash;
|
||||||
|
gate->set_target = (void*)&timetravel_set_target;
|
||||||
|
gate->get_max64 = (void*)&get_max64_0xffffLL;
|
||||||
|
// gate->set_work_data_endian = (void*)&timetravel_calc_perm;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
@@ -76,12 +76,14 @@ uint32_t getCurrentAlgoSeq(uint32_t current_time, uint32_t base_time)
|
|||||||
return (current_time - base_time) / (60 * 60 * 24);
|
return (current_time - base_time) / (60 * 60 * 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
void swap( uint8_t *a, uint8_t *b )
|
void swap( uint8_t *a, uint8_t *b )
|
||||||
{
|
{
|
||||||
uint8_t __tmp = *a;
|
uint8_t __tmp = *a;
|
||||||
*a = *b;
|
*a = *b;
|
||||||
*b = __tmp;
|
*b = __tmp;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void initPerm( uint8_t n[], uint8_t count )
|
void initPerm( uint8_t n[], uint8_t count )
|
||||||
{
|
{
|
||||||
@@ -102,10 +104,10 @@ int nextPerm( uint8_t n[], uint32_t count )
|
|||||||
|
|
||||||
if ( tail > 0 )
|
if ( tail > 0 )
|
||||||
for ( j = count - 1; j>tail && n[j] <= n[tail - 1]; j-- );
|
for ( j = count - 1; j>tail && n[j] <= n[tail - 1]; j-- );
|
||||||
swap( &n[tail - 1], &n[j] );
|
swap_vars( n[tail - 1], n[j] );
|
||||||
|
|
||||||
for ( i = tail, j = count - 1; i<j; i++, j-- )
|
for ( i = tail, j = count - 1; i<j; i++, j-- )
|
||||||
swap( &n[i], &n[j] );
|
swap_vars( n[i], n[j] );
|
||||||
|
|
||||||
return ( tail != 0 );
|
return ( tail != 0 );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
AC_INIT([cpuminer-opt], [3.5.1])
|
AC_INIT([cpuminer-opt], [3.5.2])
|
||||||
|
|
||||||
AC_PREREQ([2.59c])
|
AC_PREREQ([2.59c])
|
||||||
AC_CANONICAL_SYSTEM
|
AC_CANONICAL_SYSTEM
|
||||||
|
|||||||
11
cpu-miner.c
11
cpu-miner.c
@@ -741,7 +741,7 @@ static int share_result( int result, struct work *work, const char *reason )
|
|||||||
else
|
else
|
||||||
sres = (result ? "Accepted" : "Rejected" );
|
sres = (result ? "Accepted" : "Rejected" );
|
||||||
|
|
||||||
// Contrary to convention 100% means zero rejects, exactly 100%.
|
// Contrary to rounding convention 100% means zero rejects, exactly 100%.
|
||||||
// Rates > 99% and < 100% (rejects>0) display 99.9%.
|
// Rates > 99% and < 100% (rejects>0) display 99.9%.
|
||||||
if ( result )
|
if ( result )
|
||||||
{
|
{
|
||||||
@@ -763,11 +763,20 @@ static int share_result( int result, struct work *work, const char *reason )
|
|||||||
scale_hash_for_display ( &hashcount, hc_units );
|
scale_hash_for_display ( &hashcount, hc_units );
|
||||||
scale_hash_for_display ( &hashrate, hr_units );
|
scale_hash_for_display ( &hashrate, hr_units );
|
||||||
if ( hc_units[0] )
|
if ( hc_units[0] )
|
||||||
|
{
|
||||||
sprintf(hc, "%.2f", hashcount );
|
sprintf(hc, "%.2f", hashcount );
|
||||||
|
if ( hashrate < 10 )
|
||||||
|
// very low hashrate, add digits
|
||||||
|
sprintf(hr, "%.4f", hashrate );
|
||||||
else
|
else
|
||||||
|
sprintf(hr, "%.2f", hashrate );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// no fractions of a hash
|
// no fractions of a hash
|
||||||
sprintf(hc, "%.0f", hashcount );
|
sprintf(hc, "%.0f", hashcount );
|
||||||
sprintf(hr, "%.2f", hashrate );
|
sprintf(hr, "%.2f", hashrate );
|
||||||
|
}
|
||||||
|
|
||||||
#if ((defined(_WIN64) || defined(__WINDOWS__)))
|
#if ((defined(_WIN64) || defined(__WINDOWS__)))
|
||||||
applog( LOG_NOTICE, "%s %lu/%lu (%s%%), %s %sH, %s %sH/s",
|
applog( LOG_NOTICE, "%s %lu/%lu (%s%%), %s %sH, %s %sH/s",
|
||||||
|
|||||||
6
miner.h
6
miner.h
@@ -120,6 +120,9 @@ static inline uint32_t swab32(uint32_t v)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Swap any two variables of the same type without using a temp
|
||||||
|
#define swap_vars(a,b) a^=b; b^=a; a^=b;
|
||||||
|
|
||||||
#ifdef HAVE_SYS_ENDIAN_H
|
#ifdef HAVE_SYS_ENDIAN_H
|
||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -510,6 +513,7 @@ enum algos {
|
|||||||
ALGO_SKEIN,
|
ALGO_SKEIN,
|
||||||
ALGO_SKEIN2,
|
ALGO_SKEIN2,
|
||||||
ALGO_S3,
|
ALGO_S3,
|
||||||
|
ALGO_TIMETRAVEL,
|
||||||
ALGO_VANILLA,
|
ALGO_VANILLA,
|
||||||
ALGO_VELTOR,
|
ALGO_VELTOR,
|
||||||
ALGO_WHIRLPOOL,
|
ALGO_WHIRLPOOL,
|
||||||
@@ -567,6 +571,7 @@ static const char *algo_names[] = {
|
|||||||
"skein",
|
"skein",
|
||||||
"skein2",
|
"skein2",
|
||||||
"s3",
|
"s3",
|
||||||
|
"timetravel",
|
||||||
"vanilla",
|
"vanilla",
|
||||||
"veltor",
|
"veltor",
|
||||||
"whirlpool",
|
"whirlpool",
|
||||||
@@ -677,6 +682,7 @@ Options:\n\
|
|||||||
shavite3 Shavite3\n\
|
shavite3 Shavite3\n\
|
||||||
skein Skein+Sha (Skeincoin)\n\
|
skein Skein+Sha (Skeincoin)\n\
|
||||||
skein2 Double Skein (Woodcoin)\n\
|
skein2 Double Skein (Woodcoin)\n\
|
||||||
|
timetravel Machinecoin\n\
|
||||||
vanilla blake256r8vnl (VCash)\n\
|
vanilla blake256r8vnl (VCash)\n\
|
||||||
veltor\n\
|
veltor\n\
|
||||||
whirlpool\n\
|
whirlpool\n\
|
||||||
|
|||||||
Reference in New Issue
Block a user