util/blake3: Add blake3_hash typedef.
This is more ergonomic than unsigned char hash[BLAKE3_OUT_LEN]. Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22571>
This commit is contained in:
committed by
Marge Bot
parent
0823ab43c5
commit
e5173e62d7
@@ -34,8 +34,7 @@ void _mesa_blake3_hex_to_blake3(unsigned char *buf, const char *hex)
|
||||
mesa_hex_to_bytes(buf, hex, BLAKE3_OUT_LEN);
|
||||
}
|
||||
|
||||
void _mesa_blake3_compute(const void *data, size_t size,
|
||||
unsigned char result[BLAKE3_OUT_LEN])
|
||||
void _mesa_blake3_compute(const void *data, size_t size, blake3_hash result)
|
||||
{
|
||||
struct mesa_blake3 ctx;
|
||||
_mesa_blake3_init(&ctx);
|
||||
|
||||
@@ -31,6 +31,8 @@ extern "C" {
|
||||
|
||||
#define mesa_blake3 blake3_hasher
|
||||
|
||||
typedef uint8_t blake3_hash[BLAKE3_OUT_LEN];
|
||||
|
||||
static inline void
|
||||
_mesa_blake3_init(struct mesa_blake3 *ctx)
|
||||
{
|
||||
@@ -44,7 +46,7 @@ _mesa_blake3_update(struct mesa_blake3 *ctx, const void *data, size_t size)
|
||||
}
|
||||
|
||||
static inline void
|
||||
_mesa_blake3_final(struct mesa_blake3 *ctx, unsigned char result[BLAKE3_OUT_LEN])
|
||||
_mesa_blake3_final(struct mesa_blake3 *ctx, blake3_hash result)
|
||||
{
|
||||
blake3_hasher_finalize(ctx, result, BLAKE3_OUT_LEN);
|
||||
}
|
||||
@@ -56,7 +58,7 @@ void
|
||||
_mesa_blake3_hex_to_blake3(unsigned char *buf, const char *hex);
|
||||
|
||||
void
|
||||
_mesa_blake3_compute(const void *data, size_t size, unsigned char result[BLAKE3_OUT_LEN]);
|
||||
_mesa_blake3_compute(const void *data, size_t size, blake3_hash result);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern C */
|
||||
|
||||
Reference in New Issue
Block a user