MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / userconfig_source_digest

Function userconfig_source_digest

src/discover/userconfig.c:33–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31static const cbm_userconfig_t *g_userconfig = NULL;
32
33static void userconfig_source_digest(const char *state, const void *bytes, size_t len,
34 char out[CBM_SHA256_HEX_LEN + 1]) {
35 static const char domain[] = "cbm-userconfig-source-v1";
36 cbm_sha256_ctx sha;
37 cbm_sha256_init(&sha);
38 cbm_sha256_update(&sha, domain, sizeof(domain));
39 cbm_sha256_update(&sha, state, strlen(state) + 1);
40 if (bytes && len > 0) {
41 cbm_sha256_update(&sha, bytes, len);
42 }
43 uint8_t digest[CBM_SHA256_DIGEST_LEN];
44 cbm_sha256_final(&sha, digest);
45 static const char hex[] = "0123456789abcdef";
46 for (int i = 0; i < CBM_SHA256_DIGEST_LEN; i++) {
47 out[i * 2] = hex[digest[i] >> 4];
48 out[i * 2 + 1] = hex[digest[i] & 0x0f];
49 }
50 out[CBM_SHA256_HEX_LEN] = '\0';
51}
52
53void cbm_set_user_lang_config(const cbm_userconfig_t *cfg) {
54 g_userconfig = cfg;

Callers 2

load_config_fileFunction · 0.85
cbm_userconfig_loadFunction · 0.85

Calls 3

cbm_sha256_initFunction · 0.85
cbm_sha256_updateFunction · 0.85
cbm_sha256_finalFunction · 0.85

Tested by

no test coverage detected