cuda - error in rainbow table's generation -
i use cuda generate rainbow table, in first few chain, result seems correct. after chain index on specificed number (in example, 12800, , chains num 25600),the end indexs become sorted list. , here's implemention:
and here's implemention:
__device__ ulong hashtoindex(unsigned char* hash, ulong offset, int pos, ulong plainspacetotal) { ulong* hashp = (ulong*)hash; return (ulong)(((*(hashp) ^ *(hashp + 1) ^ *(hashp + 2) ^ *(hashp + 3)) + offset + pos) % plainspacetotal); } __device__ void indextoplain(ulong index, size_t plaincharsetsize, size_t plainlength, char* plain) { (size_t = 0;i < plainlength;i++) { plain[i] = plaincharset[index % plaincharsetsize]; index /= plaincharsetsize; } } __global__ void generatechain(struct chain* chains, size_t plaincharsetsize, size_t plainlength, size_t chainlength, ulong plainspacetotal) { unsigned char hash[32]; char plain[12]; uint offset = ((griddim.x * blockdim.x) * ((blockidx.y * blockdim.y) + threadidx.y)) + ((blockidx.x * blockdim.x) + threadidx.x); struct chain* chain; //if (offset < chains_size) { chain = chains + offset; ulong indexe = chain->indexs; (int = 0;i < chainlength;i++) { indextoplain(indexe, plaincharsetsize, plainlength, (char *)plain); plaintohash(plain, plainlength, hash); indexe = hashtoindex(hash, offset, i, plainspacetotal); } chain->indexe = indexe; //} }
plaintohash sha256 algorithm.
i've examine many times, when chains num low, 2000, problem not happen, when chains num become large, problem happen.and different chains num,there's different index on index,the indexe seems wrong.
wiki
Comments
Post a Comment