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

Function minimum_same_bytes

keyhunt_legacy.cpp:6221–6234  ·  view source on GitHub ↗

A and B are binary o string data pointers length the max lenght to check. Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow */

Source from the content-addressed store, hash-verified

6219Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow
6220*/
6221int minimum_same_bytes(unsigned char* A,unsigned char* B, int length) {
6222 int minBytes = 0; // Assume initially that all bytes are the same
6223 if(A == NULL || B == NULL) { // In case of some NULL pointer
6224 return 0;
6225 }
6226 for (int i = 0; i < length; i++) {
6227 if (A[i] != B[i]) {
6228 break; // Exit the loop since we found a mismatch
6229 }
6230 minBytes++; // Update the minimum number of bytes where data is the same
6231 }
6232
6233 return minBytes;
6234}
6235
6236void checkpointer(void *ptr,const char *file,const char *function,const char *name,int line) {
6237 if(ptr == NULL) {

Callers 1

addvanityFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected