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

Function userconfig_source_digest

src/discover/userconfig.c:50–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50static void userconfig_source_digest(const char *state, const void *bytes, size_t len,
51 char out[CBM_SHA256_HEX_LEN + 1]) {
52 static const char domain[] = "cbm-userconfig-source-v1";
53 cbm_sha256_ctx sha;
54 cbm_sha256_init(&sha);
55 cbm_sha256_update(&sha, domain, sizeof(domain));
56 cbm_sha256_update(&sha, state, strlen(state) + 1);
57 if (bytes && len > 0) {
58 cbm_sha256_update(&sha, bytes, len);
59 }
60 uint8_t digest[CBM_SHA256_DIGEST_LEN];
61 cbm_sha256_final(&sha, digest);
62 static const char hex[] = "0123456789abcdef";
63 for (int i = 0; i < CBM_SHA256_DIGEST_LEN; i++) {
64 out[i * 2] = hex[digest[i] >> 4];
65 out[i * 2 + 1] = hex[digest[i] & 0x0f];
66 }
67 out[CBM_SHA256_HEX_LEN] = '\0';
68}
69
70void cbm_set_user_lang_config(const cbm_userconfig_t *cfg) {
71 g_userconfig = cfg;

Callers 4

load_config_fileFunction · 0.85
load_project_sourceFunction · 0.85
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