| 26 | }; |
| 27 | |
| 28 | static void cv_hash_bytes(const char *bytes, size_t len, char hex[CBM_SHA256_HEX_LEN + 1]) { |
| 29 | cbm_sha256_ctx hash; |
| 30 | cbm_sha256_init(&hash); |
| 31 | if (len) |
| 32 | cbm_sha256_update(&hash, bytes, len); |
| 33 | uint8_t digest[CBM_SHA256_DIGEST_LEN]; |
| 34 | cbm_sha256_final(&hash, digest); |
| 35 | static const char digits[] = "0123456789abcdef"; |
| 36 | for (int i = 0; i < CBM_SHA256_DIGEST_LEN; i++) { |
| 37 | hex[i * 2] = digits[digest[i] >> 4]; |
| 38 | hex[i * 2 + 1] = digits[digest[i] & 15]; |
| 39 | } |
| 40 | hex[CBM_SHA256_HEX_LEN] = '\0'; |
| 41 | } |
| 42 | |
| 43 | static bool cv_records(const char *text, size_t len, int *count) { |
| 44 | *count = 0; |
no test coverage detected