add hamming_distance
All checks were successful
Test and Deploy / test (push) Successful in 13s
Test and Deploy / docs (push) Successful in 21s

This commit is contained in:
2024-05-05 17:05:12 -07:00
parent c81c8bfa3c
commit 89a3585c7f
4 changed files with 22 additions and 4 deletions

View File

@ -374,7 +374,12 @@ void test_crypto() {
free(enc);
free(s);
unsigned int hamming = hamming_distance("this is a test", "wokka wokka!!!");
unsigned char ua[2] = { 0x2, 0xF };
unsigned char ub[2] = { 0x4, 0xE };
unsigned int hamming = hamming_distance(ua, ub, 2);
assert(hamming == 3);
hamming = hamming_distance_s("this is a test", "wokka wokka!!!");
assert(hamming == 37);
printf("Passes all crypto tests\n");