core: blob+stream: Store stream/blob hashes

Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
2026-04-30 21:28:09 -04:00
parent 1d4bb8769a
commit e35d8cf136
7 changed files with 18 additions and 1 deletions
+3
View File
@@ -95,6 +95,9 @@ blob_list_dump(struct blob_list *lp)
while (blob != NULL) {
printf("blob %zd/%zd\n", count++, lp->count);
printf("... length :: %zd\n", blob->length);
printf("... hash :: ");
dump_bytes(blob->hash, SHA256_N_BYTES);
printf("... data :: ");
dump_bytes(blob->data, blob->length < DUMP_SIZE
? blob->length
+1
View File
@@ -22,5 +22,6 @@ blob_allocate(struct data_stream *stmp)
memcpy(bp->data, stmp->data, stmp->length);
}
memcpy(bp->hash, stmp->hash, SHA256_N_BYTES);
return bp;
}
+2
View File
@@ -9,6 +9,7 @@
#include <errno.h>
#include <fcntl.h>
#include <unistd.h>
#include <openssl/sha.h>
#include "blobchain/memlib.h"
#include "blobchain/stream.h"
@@ -56,6 +57,7 @@ stream_from_file(struct data_stream *stmp, const char *path)
return -1;
}
SHA256(stmp->data, stmp->length, stmp->hash);
return 0;
}