| 74 | } |
| 75 | |
| 76 | void cbm_sha256_update(cbm_sha256_ctx *c, const void *data, size_t len) { |
| 77 | const uint8_t *p = (const uint8_t *)data; |
| 78 | for (size_t i = 0; i < len; i++) { |
| 79 | c->buf[c->buflen++] = p[i]; |
| 80 | if (c->buflen == 64) { |
| 81 | sha256_transform(c, c->buf); |
| 82 | c->bitlen += 512; |
| 83 | c->buflen = 0; |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | void cbm_sha256_final(cbm_sha256_ctx *c, uint8_t out[CBM_SHA256_DIGEST_LEN]) { |
| 89 | c->bitlen += (uint64_t)c->buflen * 8; |
no test coverage detected