core: blob+stream: Store stream/blob hashes
Signed-off-by: Chloe M. <chloe@mirocom.org>
This commit is contained in:
@@ -9,17 +9,20 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "blobchain/stream.h"
|
||||
#include "blobchain/common.h"
|
||||
|
||||
/*
|
||||
* Represents a single blob of data
|
||||
*
|
||||
* @data: Buffer containing blob data
|
||||
* @length: Length of blob
|
||||
* @hash: Hash of file contents
|
||||
* @next: Next blob
|
||||
*/
|
||||
struct blob {
|
||||
void *data;
|
||||
size_t length;
|
||||
uint8_t hash[SHA256_N_BYTES];
|
||||
struct blob *next;
|
||||
};
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef BLOBCHAIN_COMMON_H
|
||||
#define BLOBCHAIN_COMMON_H 1
|
||||
|
||||
#define SHA256_N_BYTES 32
|
||||
|
||||
#define BLOBCHAIN_DEBUG 1
|
||||
#define BLOBCHAIN_VERSION "0.0.1"
|
||||
|
||||
|
||||
@@ -6,17 +6,21 @@
|
||||
#ifndef BLOBCHAIN_STREAM_H
|
||||
#define BLOBCHAIN_STREAM_H 1
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "blobchain/common.h"
|
||||
|
||||
/*
|
||||
* Represents a data stream
|
||||
*
|
||||
* @data: Data buffer
|
||||
* @length: Number of bytes in data buffer
|
||||
* @hash: SHA256 hash of file contents
|
||||
*/
|
||||
struct data_stream {
|
||||
void *data;
|
||||
size_t length;
|
||||
uint8_t hash[SHA256_N_BYTES];
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user