So here is the code:
int thread = blockIdx.x * blockDim.x + threadIdx.x + 0xeafe7436;
uchar m[12];
uint res[4];
m[0] = (uchar)(thread & 0x000000ff);
m[1] = (uchar)((thread >> 8) & 0x000000ff);
m[2] = (uchar)((thread >> 16) & 0x000000ff);
m[3] = (uchar)((thread >> 24) & 0x000000ff);
for (unsigned long long i = 0; i < 0xffffffffffffffff; i++) {
m[4] = (uchar)(i & 0x00000000000000ff);
m[5] = (uchar)((i >> 8) & 0x00000000000000ff);
m[6] = (uchar)((i >> 16) & 0x00000000000000ff);
m[7] = (uchar)((i >> 24) & 0x00000000000000ff);
m[8] = (uchar)((i >> 32) & 0x00000000000000ff);
m[9] = (uchar)((i >> 40) & 0x00000000000000ff);
m[10] = (uchar)((i >> 48) & 0x00000000000000ff);
m[11] = (uchar)((i >> 56) & 0x00000000000000ff);
md5(m, 12, res);
}
The shifting and bitwise operations, I think, make my code slower then it should be, so I wanted to try to use memcpy
to see if that is faster.
I want to copy the value of i
to m
, sarting at index 4. How would I do this using memcpy
? I have looked into other questions but found them confusing and hard to understand and could not do it myself.