From e19aea6f3f663f5a54d810027798668e1bbc54bf Mon Sep 17 00:00:00 2001 From: brichard19 Date: Fri, 23 Nov 2018 18:37:41 -0500 Subject: [PATCH] Fixed bug where clBitCrack was not obeying --stride option --- CLKeySearchDevice/CLKeySearchDevice.cpp | 12 ++++++++---- CudaKeySearchDevice/CudaKeySearchDevice.cpp | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CLKeySearchDevice/CLKeySearchDevice.cpp b/CLKeySearchDevice/CLKeySearchDevice.cpp index 82fe9d0..ae6b930 100644 --- a/CLKeySearchDevice/CLKeySearchDevice.cpp +++ b/CLKeySearchDevice/CLKeySearchDevice.cpp @@ -195,6 +195,8 @@ void CLKeySearchDevice::init(const secp256k1::uint256 &start, int compression, u _start = start; + _stride = stride; + _compression = compression; allocateBuffers(); @@ -415,8 +417,7 @@ void CLKeySearchDevice::getResultsInternal() KeySearchResult minerResult; // Calculate the private key based on the number of iterations and the current thread - //secp256k1::uint256 offset((uint64_t)_blocks * _threads * _pointsPerThread * _iterations + getPrivateKeyOffset(ptr[i].thread, ptr[i].block, ptr[i].idx)); - secp256k1::uint256 offset = (secp256k1::uint256((uint64_t)_blocks * _threads * _pointsPerThread * _iterations) + secp256k1::uint256(getPrivateKeyOffset(ptr[i].thread, ptr[i].block, ptr[i].idx))) * _stride; + secp256k1::uint256 offset = (secp256k1::uint256((uint64_t)_blocks * _threads * _pointsPerThread * _iterations) + secp256k1::uint256(getPrivateKeyOffset(ptr->thread, ptr->block, ptr->idx))) * _stride; secp256k1::uint256 privateKey = secp256k1::addModN(_start, offset); minerResult.privateKey = privateKey; @@ -588,8 +589,11 @@ void CLKeySearchDevice::generateStartingPoints() // Generate key pairs for k, k+1, k+2 ... k + secp256k1::uint256 privKey = _start; - for(uint64_t i = 0; i < totalPoints; i++) { - exponents.push_back(privKey.add(i)); + exponents.push_back(privKey); + + for(uint64_t i = 1; i < totalPoints; i++) { + privKey = privKey.add(_stride); + exponents.push_back(privKey); } unsigned int *privateKeys = new unsigned int[8 * totalPoints]; diff --git a/CudaKeySearchDevice/CudaKeySearchDevice.cpp b/CudaKeySearchDevice/CudaKeySearchDevice.cpp index 9883412..fc10628 100644 --- a/CudaKeySearchDevice/CudaKeySearchDevice.cpp +++ b/CudaKeySearchDevice/CudaKeySearchDevice.cpp @@ -245,7 +245,7 @@ void CudaKeySearchDevice::getResultsInternal() KeySearchResult minerResult; // Calculate the private key based on the number of iterations and the current thread - secp256k1::uint256 offset = (secp256k1::uint256((uint64_t)_blocks * _threads * _pointsPerThread * _iterations) + secp256k1::uint256(getPrivateKeyOffset(rPtr->thread, rPtr->block, rPtr->idx)))* _stride; + secp256k1::uint256 offset = (secp256k1::uint256((uint64_t)_blocks * _threads * _pointsPerThread * _iterations) + secp256k1::uint256(getPrivateKeyOffset(rPtr->thread, rPtr->block, rPtr->idx))) * _stride; secp256k1::uint256 privateKey = secp256k1::addModN(_startExponent, offset); minerResult.privateKey = privateKey;