- for (i = part_len; i + 63 < len; i += 64)
- sha256_transform(sctx->state, &data[i]);
- idx = 0;
- } else {
- i = 0;
- }
-
- /* Buffer remaining input */
- memcpy(&sctx->buf[idx], &data[i], len-i);
+ /* Append length (before padding) */
+ fio_sha256_update(sctx, (const uint8_t *)&bits, sizeof(bits));
+
+ /* Store state in digest */
+ for (i = 0; i < 8; i++)
+ sctx->buf[i] = sctx->state[i];