change: reduce printed noise, rework some code
Dependencies
- [2]
VKLGQREYchange: add base32 decode, initial deconstruction of hashed - [3]
OBKF6SIIchange: decompress the hashed section too - [4]
RIWSVVASchange: decompress the 'contents' with zstd_seekable - [5]
KDJUAAALchange: prefix function names with change_ - [*]
Q7TKZCJPAdd initial support for reading the offsets from a (fixed) change
Change contents
- edit in change.c at line 29
}static intcmp_hash(uint8_t *h1, uint8_t *h2){size_t i;for (i = 0; i < BLAKE3_OUT_LEN; i++)if (h1[i] != h2[i])return 1;return 0; - replacement in change.c at line 110
dump_buf("compressed", compressed, compressed_read);/* dump_buf("compressed", compressed, compressed_read); */ - replacement in change.c at line 154
change_decode_hashed(int fd, size_t comp_hashed_len, size_t hashed_len, uint8_t *expected_hash)change_decode_hashed(int fd, size_t comp_hashed_len, size_t hashed_len,uint8_t *expected_hash) - replacement in change.c at line 160
uint8_t output[BLAKE3_OUT_LEN];uint8_t computed_hash[BLAKE3_OUT_LEN]; - edit in change.c at line 162
int err = 0; - edit in change.c at line 169
dump_buf("hashed", buf, hashed_len); - edit in change.c at line 170
/* TODO Decode into 'struct hashed' */ - replacement in change.c at line 174
blake3_hasher_finalize(&b3sum, output, BLAKE3_OUT_LEN);blake3_hasher_finalize(&b3sum, computed_hash, BLAKE3_OUT_LEN); - edit in change.c at line 176
for (i = 0; i < BLAKE3_OUT_LEN; i++)printf("%02x", output[i]);printf("\n"); - replacement in change.c at line 177
for (i = 0; i < BLAKE3_OUT_LEN; i++)printf("%02x", expected_hash[i]);printf("\n");err = cmp_hash(computed_hash, expected_hash);if (err) {fprintf(stderr, "error: change hash mismatch, claimed \n");for (i = 0; i < BLAKE3_OUT_LEN; i++)fprintf(stderr, "%02x", expected_hash[i]);fprintf(stderr, ", computed ");for (i = 0; i < BLAKE3_OUT_LEN; i++)fprintf(stderr, "%02x", expected_hash[i]);fprintf(stderr, "\n");} - edit in change.c at line 188
/* TODO Decode into 'struct hashed' */ - replacement in change.c at line 192
return 0;return err; - replacement in change.c at line 264
dump_buf("contents", contents, off.contents_len);/* dump_buf("contents", contents, off.contents_len); */