Skip to content

Commit

Permalink
Some technical changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkud committed Nov 18, 2019
1 parent a9e3a9c commit 746839c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
9 changes: 8 additions & 1 deletion BruteForceManager/BruteForceManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,14 @@ def MainFunc():
threading.Thread(target=Worker, args=(".\\BruteForceSHA1CUDA.exe {}".format(authdata.decode("UTF-8")),)).start()
#RunCPUFarm(authdata)
if not event_suffix_found.wait(7200):
#StopAllCPUFarm()
subprocess.call("taskkill /IM BruteForceSHA1CUDA.exe /T /F")
time.sleep(5)
conn.close()

#StopAllCPUFarm()
#print("Nothing happends")
#exit(0)

return True
break
conn.write(result_suffix + b"\n")
Expand Down Expand Up @@ -217,6 +221,9 @@ def MainFunc():

if __name__ == '__main__':
#UpdateAllCPUFarmWithNewVersion()
#exit(0)
#StopAllCPUFarm()
#exit(0)
while True:
try:
MainFunc()
Expand Down
4 changes: 2 additions & 2 deletions BruteForceSHA1CPU/src/BruteForceSHA1CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static void* Worker(void *param) {
struct timeval tv1;
gettimeofday(&tv1, NULL);
std::default_random_engine generator(tv1.tv_usec);
std::uniform_int_distribution<int> distribution(33, 127);
std::uniform_int_distribution<int> distribution(33, 126);
for (int i = 0; i < 55; i++)
data[i] = distribution(generator);
data[55] = 0x80;
Expand All @@ -47,7 +47,7 @@ static void* Worker(void *param) {
while (true) {
pos_cur = data;
while (true) {
if ((*pos_cur) == 127) {
if ((*pos_cur) == 126) {
(*pos_cur) = 33;
pos_cur++;
continue;
Expand Down
7 changes: 5 additions & 2 deletions BruteForceSHA1CUDA/kernel.cu
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ sha_transform(int *ret_block, __u32 *in_block)

if (((a) == 0)) {
b += g_cSHA1baseCode[1];
if ((b & 0xffff0000) == 0) {
if ((b & 0xfff00000) == 0) {
block[0] = wi[0];
block[1] = wi[1];
block[2] = wi[2];
Expand Down Expand Up @@ -392,9 +392,12 @@ int main(int argc, char **argv)
std::uniform_int_distribution<int> distribution(33, 126);

unsigned char data[2048 * 64];
//memset(data, 33, 2048 * 64);
for (int j = 0; j < 2048; j++) {
for (int i = 0; i < 56; i++)
data[j*64 + i] = distribution(generator);
//data[j * 64] = 33 + (j % 94);
//data[j * 64 + 1] = 33 + int(j / 94);

data[j * 64 + 52] = 0x80;
memset(j * 64 + data + 56, 0, 8);
Expand Down Expand Up @@ -470,7 +473,7 @@ cudaError_t addWithCuda(__u32 SHA1Sum[], __u8 SHA1Data[], int *retVal)
}

// Launch a kernel on the GPU with one thread for each element.
sha_transform <<<64, 32>>>(dev_retVal, dev_SHA1Data);
sha_transform <<<32, 64>>>(dev_retVal, dev_SHA1Data);

// Check for any errors launching the kernel
cudaStatus = cudaGetLastError();
Expand Down

0 comments on commit 746839c

Please sign in to comment.