wrap vendored blake3 in own file, #2
Dependencies
- [2]
L3HKOF4Wwrap vendored zstd seekable in own file, #2 - [3]
XTKRT6OQformat the codebase - [4]
Q7TKZCJPAdd initial support for reading the offsets from a (fixed) change - [5]
CYS4NENLmove zstdseek files to vendor/zstdseek - [6]
2U7P5SFQChange struct names "struct foo -> typedef struct Foo" - [7]
VKLGQREYchange: add base32 decode, initial deconstruction of hashed - [8]
QYRJIOYPchange: separate decoding and printing of hashed struct - [9]
OBKF6SIIchange: decompress the hashed section too - [10]
YG4DZB3Aadd representation of hash, decode dependencies - [11]
2C2EF2GKmove blake3 files to vendor/blake3 - [12]
RIWSVVASchange: decompress the 'contents' with zstd_seekable - [13]
3FT3XTJMchange: support -v/-h flags - [14]
WMFNGOYTchange: reduce printed noise, rework some code - [15]
Y26WT3ZFchange: decode message, description and timestamp - [*]
XJ2PEH74add meson.build - [*]
PEUS54XQ
Change contents
- edit in meson.build at line 31
'blake3.c', - replacement in change.c at line 12
#include "vendor/blake3/blake3.h"#include "blake3.h" - edit in change.c at line 37
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 340
blake3_hasher b3sum;uint8_t computed_hash[BLAKE3_OUT_LEN];uint8_t computed_hash[BLAKE3_LEN]; - edit in change.c at line 353
blake3_hash(computed_hash, buf, hashed_len); - edit in change.c at line 355[3.1056]→[3.1056:1133](∅→∅),[3.1133]→[3.363:427](∅→∅),[3.427]→[3.1190:1191](∅→∅),[3.1190]→[3.1190:1191](∅→∅)
blake3_hasher_init(&b3sum);blake3_hasher_update(&b3sum, buf, hashed_len);blake3_hasher_finalize(&b3sum, computed_hash, BLAKE3_OUT_LEN); - replacement in change.c at line 356
err = cmp_hash(computed_hash, expected_hash);err = blake3_cmp(computed_hash, expected_hash); - replacement in change.c at line 360
for (i = 0; i < BLAKE3_OUT_LEN; i++)for (i = 0; i < BLAKE3_LEN; i++) - replacement in change.c at line 363
for (i = 0; i < BLAKE3_OUT_LEN; i++)for (i = 0; i < BLAKE3_LEN; i++) - file addition: blake3.h[18.1]
#ifndef ANI_BLAKE3_H#define ANI_BLAKE3_H/* Wrapper for the vendored blake3 hash algorithm (the C implementation) */#define BLAKE3_LEN 32/* Hash the given input of the indicated length and put the result in out */void blake3_hash(uint8_t *out, uint8_t *in, size_t len);/* Compare two hashes */int blake3_cmp(uint8_t *h1, uint8_t *h2);#endif - file addition: blake3.c[18.1]
#include <stdint.h>#include "vendor/blake3/blake3.h"#include "blake3.h"voidblake3_hash(uint8_t *out, uint8_t *in, size_t len){blake3_hasher b3sum;blake3_hasher_init(&b3sum);blake3_hasher_update(&b3sum, in, len);blake3_hasher_finalize(&b3sum, out, BLAKE3_OUT_LEN);}intblake3_cmp(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;}