commit 5416f55621c0270feb4bc0dc5ad188417a4b469f
parent 2f107c7c265fee6330a93d8cbfe1ead0fbc96fd4
Author: Alexandre Bique <bique.alexandre@gmail.com>
Date: Fri, 27 May 2022 17:20:01 +0200
Rework the file reference
Diffstat:
2 files changed, 9 insertions(+), 45 deletions(-)
diff --git a/include/clap/ext/draft/file-reference.h b/include/clap/ext/draft/file-reference.h
@@ -1,7 +1,6 @@
#pragma once
#include "../../plugin.h"
-#include "../../hash.h"
#include "../../string-sizes.h"
static CLAP_CONSTEXPR const char CLAP_EXT_FILE_REFERENCE[] = "clap.file-reference.draft/0";
@@ -51,12 +50,16 @@ typedef struct clap_plugin_file_reference {
// This method does not compute the hash.
// It is only used in case of missing resource. The host may have additionnal known resource
// location and may be able to locate the file by using its known hash.
+ //
+ // algorithm: string that identify the hashing algorithm to use.
+ // Currently only "blake3" is supported. See https://github.com/BLAKE3-team/BLAKE3 for details.
+ //
// [main-thread]
- bool (*get_hash)(const clap_plugin_t *plugin,
- clap_id resource_id,
- clap_hash hash,
- uint8_t *digest,
- uint32_t digest_size);
+ bool (*get_digest)(const clap_plugin_t *plugin,
+ clap_id resource_id,
+ const char *algorithm,
+ uint8_t *digest,
+ uint32_t digest_size);
// updates the path to a file reference
// [main-thread]
diff --git a/include/clap/hash.h b/include/clap/hash.h
@@ -1,39 +0,0 @@
-#pragma once
-
-#include "private/std.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// Commonly used hashing algorithms
-enum {
- CLAP_HASH_CRC32 = 0,
- CLAP_HASH_CRC64 = 1,
-
- CLAP_HASH_MD5 = 1000,
-
- // SHA family
- CLAP_HASH_SHA1 = 2000,
-
- CLAP_HASH_SHA2_224 = 3000,
- CLAP_HASH_SHA2_256,
- CLAP_HASH_SHA2_384,
- CLAP_HASH_SHA2_512,
- CLAP_HASH_SHA2_512_224, // state: 512, digest: 224
- CLAP_HASH_SHA2_512_256, // state: 512, digest: 256
-
- CLAP_HASH_SHA3_224 = 4000,
- CLAP_HASH_SHA3_256,
- CLAP_HASH_SHA3_384,
- CLAP_HASH_SHA3_512,
-
- // BLAKE family
- CLAP_BLAKE2 = 20000,
- CLAP_BLAKE3 = 21000,
-};
-typedef uint32_t clap_hash;
-
-#ifdef __cplusplus
-}
-#endif