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

Function cv2_hash

src/mcp/test_impact_coverage.c:1185–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1183}
1184
1185static bool cv2_hash(cv2_context_t *ctx, cv2_span_t span, char hex[CBM_SHA256_HEX_LEN + 1]) {
1186 cbm_sha256_ctx hash;
1187 cbm_sha256_init(&hash);
1188 size_t at = 0;
1189 while (at < span.length) {
1190 if (!cv2_poll(ctx))
1191 return false;
1192 size_t chunk = span.length - at;
1193 if (chunk > 4096)
1194 chunk = 4096;
1195 cbm_sha256_update(&hash, span.data + at, chunk);
1196 at += chunk;
1197 }
1198 uint8_t digest[CBM_SHA256_DIGEST_LEN];
1199 cbm_sha256_final(&hash, digest);
1200 static const char digits[] = "0123456789abcdef";
1201 for (int i = 0; i < CBM_SHA256_DIGEST_LEN; i++) {
1202 if (!cv2_step(ctx))
1203 return false;
1204 hex[i * 2] = digits[digest[i] >> 4];
1205 hex[i * 2 + 1] = digits[digest[i] & 15];
1206 }
1207 hex[CBM_SHA256_HEX_LEN] = '\0';
1208 return cv2_poll(ctx);
1209}
1210
1211static cbm_coverage_parse_status_t cv2_arguments(const void *profiles, size_t profiles_len,
1212 const char *tests, size_t tests_len,

Callers 1

Calls 5

cbm_sha256_initFunction · 0.85
cv2_pollFunction · 0.85
cbm_sha256_updateFunction · 0.85
cbm_sha256_finalFunction · 0.85
cv2_stepFunction · 0.85

Tested by

no test coverage detected