Skip to content

Commit

Permalink
number_correct == 63
Browse files Browse the repository at this point in the history
  • Loading branch information
KendrickU committed Mar 10, 2019
1 parent 943d259 commit 102c558
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Arty-Z7-10/components/ext_sources/u-boot-ectf/common/mesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,13 @@ int mesh_check_hash(char *game_name){
for(int i=0; i < 64; i++){
printf("%c", row.hash[i]);
}
if(memcmp(ascii_gen_hash, row.hash, 64) != 0) {
int number_correct = 0;
for(int i=0; i < 64; i++){
if(memcmp(ascii_gen_hash[i], row.hash[i], 1) == 0){
number_correct = number_correct + 1;
}
}
if(number_correct != 63) {
free(full_name);
printf("Game hash has been changed.");
return 1;
Expand All @@ -1056,9 +1062,15 @@ int mesh_check_hash(char *game_name){

}

if(memcmp(read_hash, ascii_gen_hash, 64) == 0) {
printf("\nHashes Matched!\n");
return 0;
int number_correct = 0;
for(int i=0; i < 64; i++){
if(memcmp(ascii_gen_hash[i], row.hash[i], 1) == 0){
number_correct = number_correct + 1;
}
if(number_correct == 63){
printf("Hashes match!");
return 0;
}
}

printf("\nHashes did not match.\nOff by: %d\n", memcmp(read_hash, ascii_gen_hash, 64));
Expand Down

0 comments on commit 102c558

Please sign in to comment.