MCPcopy Create free account
hub / github.com/albertobsd/keyhunt / searchbinary

Function searchbinary

keyhunt.cpp:2311–2335  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2309}
2310
2311int searchbinary(struct address_value *buffer,char *data,int64_t array_length) {
2312 int64_t half,min,max,current;
2313 int r = 0,rcmp;
2314 min = 0;
2315 current = 0;
2316 max = array_length;
2317 half = array_length;
2318 while(!r && half >= 1) {
2319 half = (max - min)/2;
2320 rcmp = memcmp(data,buffer[current+half].value,20);
2321 if(rcmp == 0) {
2322 r = 1; //Found!!
2323 }
2324 else {
2325 if(rcmp < 0) { //data < temp_read
2326 max = (max-half);
2327 }
2328 else { // data > temp_read
2329 min = (min+half);
2330 }
2331 current = min;
2332 }
2333 }
2334 return r;
2335}
2336
2337#if defined(_WIN64) && !defined(__CYGWIN__)
2338DWORD WINAPI thread_process_minikeys(LPVOID vargp) {

Callers 2

thread_process_minikeysFunction · 0.70
thread_processFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected