Changes

Jump to: navigation, search

GPU610/DPS915 MCM Decrypt

983 bytes added, 19:24, 1 November 2013
Kernel Attempts
So far I have made attempts to convert different pieces of compute heavy code into kernels in order to obtain the same results as the original code but none have been successful.
Original Code 1:
<source lang="cpp">
unsigned long nr=1345345333L;
unsigned long add=7;
unsigned long nr2=0x12345671L;
unsigned long tmp;
int passLen = strlen(password);
 
for (int i = 0; i < passLen; i++) {
if (*password == ' ' || *password == '\t')
continue;
tmp= (unsigned long) (unsigned char) password[i];
nr^= (((nr & 63)+add)*tmp)+ (nr << 8);
nr2+=(nr2 << 8) ^ nr;
add+=tmp;
}
</source>
 
Kernel Attempt 1:
<source lang="cpp">
__global__ void hash_password_kernel(unsigned long* nr, unsigned long* nr2, unsigned long* add, const char *password) {
int idx = blockIdx.x * blockDim.x + threadIdx.x;
 
unsigned long tmp;
 
tmp= (unsigned long) (unsigned char) password[threadIdx.x];
*nr^= (((*nr & 63)+*add)*tmp)+ (*nr << 8);
*nr2+=(*nr2 << 8) ^ *nr;
*add+=tmp;
 
}
</source>
 
Original Code 2:
<source lang="cpp">for(int i=pos; i<max; i++) {
if(data[i] != max) {
data[i]++;
pos=i;
break;
}
}
 
</source>
 
Kernel Attempt 2:
<source lang="cpp">
__global__ void testKernel(unsigned char *data, unsigned int max, unsigned int* pos) {
if(data[threadIdx.x] != max) { data[threadIdx.x]++; *pos=threadIdx.x;//break; }
}

Navigation menu