/* sha256.h — minimal public-domain SHA-256 context/API for MeowOS .mpk payload hashing. * Used by meow_verify (device) and meow_sign (host) to compute .mpk 的 payload_sha256 * (tar.gz 前缀哈希)。流式 API,避免整包载入内存。 */ #ifndef MEOW_SHA256_H #define MEOW_SHA256_H #include #include typedef struct { uint32_t state[8]; uint64_t count; /* 已输入总字节数 */ uint8_t buf[64]; /* 未满一块的缓冲 */ size_t buflen; } meow_sha256_ctx; void meow_sha256_init(meow_sha256_ctx *c); void meow_sha256_update(meow_sha256_ctx *c, const uint8_t *data, size_t len); void meow_sha256_final(meow_sha256_ctx *c, uint8_t out[32]); #endif /* MEOW_SHA256_H */