Browse Source

neoscrypt: adapt for visual studio compat

todo: fix SM 3.0 builds
2upstream
Tanguy Pruvot 10 years ago
parent
commit
15584e4f05
  1. 2
      ccminer.cpp
  2. 4
      ccminer.vcxproj
  3. 9
      ccminer.vcxproj.filters
  4. 2
      miner.h
  5. 11
      neoscrypt.cu
  6. 4
      neoscrypt/cuda_neoscrypt.cu
  7. 10
      neoscrypt/neoscrypt.c
  8. 2
      neoscrypt/neoscrypt.h
  9. 2
      util.cpp

2
ccminer.cpp

@ -275,7 +275,7 @@ Options:\n\
lyra2 VertCoin\n\ lyra2 VertCoin\n\
mjollnir Mjollnircoin\n\ mjollnir Mjollnircoin\n\
myr-gr Myriad-Groestl\n\ myr-gr Myriad-Groestl\n\
neoscrypt use to mine FeatherCoin\n\ neoscrypt FeatherCoin, Phoenix, UFO...\n\
nist5 NIST5 (TalkCoin)\n\ nist5 NIST5 (TalkCoin)\n\
penta Pentablake hash (5x Blake 512)\n\ penta Pentablake hash (5x Blake 512)\n\
pluck SupCoin\n\ pluck SupCoin\n\

4
ccminer.vcxproj

@ -179,7 +179,7 @@
<MaxRegCount>80</MaxRegCount> <MaxRegCount>80</MaxRegCount>
<PtxAsOptionV>true</PtxAsOptionV> <PtxAsOptionV>true</PtxAsOptionV>
<Keep>true</Keep> <Keep>true</Keep>
<CodeGeneration>compute_30,sm_30;compute_35,sm_35;compute_50,sm_50;compute_52,sm_52</CodeGeneration> <CodeGeneration>compute_35,sm_35;compute_50,sm_50;compute_52,sm_52</CodeGeneration>
<AdditionalOptions>--ptxas-options="-O2" %(AdditionalOptions)</AdditionalOptions> <AdditionalOptions>--ptxas-options="-O2" %(AdditionalOptions)</AdditionalOptions>
<Defines> <Defines>
</Defines> </Defines>
@ -536,4 +536,4 @@
<Target Name="AfterClean"> <Target Name="AfterClean">
<Delete Files="@(FilesToCopy->'$(OutDir)%(Filename)%(Extension)')" TreatErrorsAsWarnings="true" /> <Delete Files="@(FilesToCopy->'$(OutDir)%(Filename)%(Extension)')" TreatErrorsAsWarnings="true" />
</Target> </Target>
</Project> </Project>

9
ccminer.vcxproj.filters

@ -231,6 +231,9 @@
<ClCompile Include="scrypt-jane.cpp"> <ClCompile Include="scrypt-jane.cpp">
<Filter>Source Files\CUDA\scrypt</Filter> <Filter>Source Files\CUDA\scrypt</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="neoscrypt\neoscrypt.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="compat.h"> <ClInclude Include="compat.h">
@ -619,6 +622,12 @@
<CudaCompile Include="scrypt\titan_kernel.cu"> <CudaCompile Include="scrypt\titan_kernel.cu">
<Filter>Source Files\CUDA\scrypt</Filter> <Filter>Source Files\CUDA\scrypt</Filter>
</CudaCompile> </CudaCompile>
<CudaCompile Include="neoscrypt\cuda_neoscrypt.cu">
<Filter>Source Files\CUDA</Filter>
</CudaCompile>
<CudaCompile Include="neoscrypt.cu">
<Filter>Source Files</Filter>
</CudaCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="res\ccminer.ico"> <Image Include="res\ccminer.ico">

2
miner.h

@ -692,7 +692,7 @@ unsigned int jackpothash(void *state, const void *input);
void groestlhash(void *state, const void *input); void groestlhash(void *state, const void *input);
void lyra2_hash(void *state, const void *input); void lyra2_hash(void *state, const void *input);
void myriadhash(void *state, const void *input); void myriadhash(void *state, const void *input);
void neoscrypt(const uchar *password, uchar *output, uint profile); void neoscrypt(uchar *output, const uchar *input, uint32_t profile);
void nist5hash(void *state, const void *input); void nist5hash(void *state, const void *input);
void pentablakehash(void *output, const void *input); void pentablakehash(void *output, const void *input);
void pluckhash(uint32_t *hash, const uint32_t *data, uchar *hashbuffer, const int N); void pluckhash(uint32_t *hash, const uint32_t *data, uchar *hashbuffer, const int N);

11
neoscrypt.cu

@ -16,7 +16,6 @@ extern uint32_t neoscrypt_cpu_hash_k4(int stratum, int thr_id, uint32_t threads,
int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done) int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uint32_t max_nonce, unsigned long *hashes_done)
{ {
const uint32_t first_nonce = pdata[19]; const uint32_t first_nonce = pdata[19];
const int stratum = have_stratum;
if (opt_benchmark) if (opt_benchmark)
((uint32_t*)ptarget)[7] = 0x0000ff; ((uint32_t*)ptarget)[7] = 0x0000ff;
@ -41,7 +40,7 @@ int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uin
} }
uint32_t endiandata[20]; uint32_t endiandata[20];
if (stratum) { if (have_stratum) {
for (int k = 0; k < 20; k++) for (int k = 0; k < 20; k++)
be32enc(&endiandata[k], ((uint32_t*)pdata)[k]); be32enc(&endiandata[k], ((uint32_t*)pdata)[k]);
} else { } else {
@ -52,19 +51,19 @@ int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uin
neoscrypt_setBlockTarget(endiandata,ptarget); neoscrypt_setBlockTarget(endiandata,ptarget);
do { do {
uint32_t foundNonce = neoscrypt_cpu_hash_k4(stratum, thr_id, throughput, pdata[19], 0); uint32_t foundNonce = neoscrypt_cpu_hash_k4((int)have_stratum, thr_id, throughput, pdata[19], 0);
if (foundNonce != UINT32_MAX) if (foundNonce != UINT32_MAX)
{ {
uint32_t _ALIGN(64) vhash64[8]; uint32_t _ALIGN(64) vhash64[8];
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
if (stratum) { if (have_stratum) {
be32enc(&endiandata[19], foundNonce); be32enc(&endiandata[19], foundNonce);
} else { } else {
endiandata[19] = foundNonce; endiandata[19] = foundNonce;
} }
neoscrypt((uchar*) endiandata, (uchar*)vhash64, 0x80000620); neoscrypt((uchar*)vhash64, (uchar*) endiandata, 0x80000620U);
if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) { if (vhash64[7] <= ptarget[7] && fulltest(vhash64, ptarget)) {
pdata[19] = foundNonce; pdata[19] = foundNonce;
@ -76,7 +75,7 @@ int scanhash_neoscrypt(int thr_id, uint32_t *pdata, const uint32_t *ptarget, uin
pdata[19] += throughput; pdata[19] += throughput;
} while (!work_restart[thr_id].restart && ((uint64_t)max_nonce > ((uint64_t)(pdata[19]) + (uint64_t)throughput))); } while (!work_restart[thr_id].restart && (max_nonce > ((uint64_t)(pdata[19]) + throughput)));
*hashes_done = pdata[19] - first_nonce + 1; *hashes_done = pdata[19] - first_nonce + 1;
return 0; return 0;

4
neoscrypt/cuda_neoscrypt.cu

@ -77,8 +77,8 @@ __constant__ uint32_t BLAKE2S_SIGMA[10][16];
} }
#endif #endif
#define ROTL32(x, n) ((x) << (n)) | ((x) >> (32 - (n))) //#define ROTL32(x, n) ((x) << (n)) | ((x) >> (32 - (n)))
#define ROTR32(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) //#define ROTR32(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
#define BLAKE_Ghost(idx0, idx1, a, b, c, d, key) { \ #define BLAKE_Ghost(idx0, idx1, a, b, c, d, key) { \
idx = BLAKE2S_SIGMA_host[idx0][idx1]; a += key[idx]; \ idx = BLAKE2S_SIGMA_host[idx0][idx1]; a += key[idx]; \

10
neoscrypt/neoscrypt.c

@ -881,7 +881,7 @@ static void neoscrypt_blkmix(uint *X, uint *Y, uint r, uint mixmode)
* ..... * .....
* 11110 = N of 2147483648; * 11110 = N of 2147483648;
* profile bits 30 to 13 are reserved */ * profile bits 30 to 13 are reserved */
void neoscrypt(const uchar *password, uchar *output, uint profile) void neoscrypt(unsigned char *output, const unsigned char *input, unsigned int profile)
{ {
uint N = 128, r = 2, dblmix = 1, mixmode = 0x14, stack_align = 0x40; uint N = 128, r = 2, dblmix = 1, mixmode = 0x14, stack_align = 0x40;
uint kdf, i, j; uint kdf, i, j;
@ -916,11 +916,11 @@ void neoscrypt(const uchar *password, uchar *output, uint profile)
default: default:
case(0x0): case(0x0):
neoscrypt_fastkdf(password, 80, password, 80, 32, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE); neoscrypt_fastkdf(input, 80, input, 80, 32, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE);
break; break;
case(0x1): case(0x1):
neoscrypt_pbkdf2_sha256(password, 80, password, 80, 1, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE); neoscrypt_pbkdf2_sha256(input, 80, input, 80, 1, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE);
break; break;
} }
@ -981,11 +981,11 @@ void neoscrypt(const uchar *password, uchar *output, uint profile)
default: default:
case(0x0): case(0x0):
neoscrypt_fastkdf(password, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 32, output, 32); neoscrypt_fastkdf(input, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 32, output, 32);
break; break;
case(0x1): case(0x1):
neoscrypt_pbkdf2_sha256(password, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 1, output, 32); neoscrypt_pbkdf2_sha256(input, 80, (uchar *) X, r * 2 * SCRYPT_BLOCK_SIZE, 1, output, 32);
break; break;
} }
} }

2
neoscrypt/neoscrypt.h

@ -2,7 +2,7 @@
extern "C" { extern "C" {
#endif #endif
void neoscrypt(const unsigned char *input, unsigned char *output, unsigned int profile); void neoscrypt(unsigned char *output, const unsigned char *input, unsigned int profile);
#if (__cplusplus) #if (__cplusplus)
} }

2
util.cpp

@ -1777,7 +1777,7 @@ void print_hash_tests(void)
myriadhash(&hash[0], &buf[0]); myriadhash(&hash[0], &buf[0]);
printpfx("myriad", hash); printpfx("myriad", hash);
neoscrypt(&buf[0], &hash[0], 80000620); neoscrypt(&hash[0], &buf[0], 80000620);
printpfx("neoscrypt", hash); printpfx("neoscrypt", hash);
nist5hash(&hash[0], &buf[0]); nist5hash(&hash[0], &buf[0]);

Loading…
Cancel
Save