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

Function minimum_same_bytes

keyhunt.cpp:5967–5980  ·  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

5965Caller must by sure that the pointer are valid and have at least length bytes readebles witout causing overflow
5966*/
5967int minimum_same_bytes(unsigned char* A,unsigned char* B, int length) {
5968 int minBytes = 0; // Assume initially that all bytes are the same
5969 if(A == NULL || B == NULL) { // In case of some NULL pointer
5970 return 0;
5971 }
5972 for (int i = 0; i < length; i++) {
5973 if (A[i] != B[i]) {
5974 break; // Exit the loop since we found a mismatch
5975 }
5976 minBytes++; // Update the minimum number of bytes where data is the same
5977 }
5978
5979 return minBytes;
5980}
5981
5982void checkpointer(void *ptr,const char *file,const char *function,const char *name,int line) {
5983 if(ptr == NULL) {

Callers 1

addvanityFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected