/* scorpiox-scorpioplayer-media-hash — public C API (C99) * * Four identity hashes: Shooter, OpenSubtitles, stable UTF-16, full-stream MD5. * Bytes in, hex/decimal out. No network, no file-format parsing. */ #ifndef SCORPIOX_SPMHASH_H #define SCORPIOX_SPMHASH_H #include #include #ifdef __cplusplus extern "C" { #endif typedef enum { SPMHASH_OK = 0, SPMHASH_ERR_IO = 1, SPMHASH_ERR_TOO_SMALL = 2, SPMHASH_ERR_INVALID_ARG = 3, SPMHASH_ERR_INVALID_UTF8= 4, SPMHASH_ERR_OOM = 5 } spmhash_status; /* Shooter: 4xMD5 lowercase hex joined by ';', or decimal stable-hash fallback * when len <= 8192 and fallback_name is non-NULL. */ int spmhash_shooter_file(const char *path, const char *fallback_name); int spmhash_shooter_buffer(const unsigned char *data, size_t len, const char *fallback_name); /* OpenSubtitles: 64-bit sum, big-endian lowercase hex (16 chars). */ int spmhash_opensubtitles_file(const char *path); int spmhash_opensubtitles_buffer(const unsigned char *data, size_t len); /* Stable hash over UTF-16 code units decoded from UTF-8. * *out receives the abs'd int32; 0 is a legal hash — errors via return code. */ int spmhash_stable_utf8(const char *utf8, int32_t *out); /* Full-stream MD5, UPPERCASE hex (32 chars). */ int spmhash_md5_file(const char *path); int spmhash_md5_buffer(const unsigned char *data, size_t len); /* Result string from the last successful shooter / opensubtitles / md5 call. * Valid until the next mutating call. */ const char *spmhash_result(void); const char *spmhash_last_error(void); #ifdef __cplusplus } #endif #endif /* SCORPIOX_SPMHASH_H */