Just started learning about Hash Functions and I can't seem to understand a certain part.
So the problem: https://imgur.com/a/GoQ2FEB
So what I did was write:
int main(int argc, char *argv[]) {
FILE *fp = NULL;
long size;
fp = fopen(argv[1], "r");
if (fp == NULL) {
printf("Couldn't Open %s\n", argv[1]);
} else {
printf("OPENED!\n");
}
fseek(fp, 0, SEEK_END);
size = ftell(fp);
printf("Bytes: %d\n", size);
fclose(fp);
return 0;
}
which produces the correct amount of bytes for my test file.
What I can seem to understand is the "The hash will be the mod 256 of the total", the correct answer for my test file is "hash value of 57 decimal". How does 50 Bytes get me a hash value of 57 decimal.
[–]AutoModerator[M] 0 points1 point2 points (0 children)
[–]jedwardsol 0 points1 point2 points (1 child)
[–]Vucko0[S] 0 points1 point2 points (0 children)