Incorrect MD5 for a sequence submit
- Dominant language
- C
- Stars
- 301
- Forks
- 91
- PR merge metrics
- No merged PRs in 30d
Description
Hi, usually I need to calculate the MD5 value of large files which could up to 20 GB or more, so I submit the jobs one by one with 10 MB chunks sequentially for one file. And I noticed that for the same context the new job submit is not allowed before the previous one is completed, so I use this
```
while (hash_ctx_processing(ctx)) {
md5_ctx_mgr_flush(mgr);
}
```
before each submits, and also before the fetch of the digest. But if the submit size is larger than 63 Bytes the result is incorrect. However, if I put the flush method after the submit method instead of before, there is no such issue. I just wonder what' the difference between before and after, no matter which way I have used before the fetch of digest I have the status HASH_CTX_STS_COMPLETE.
The reason I wanna the flush before the submit because I have a context pool so that I have tried to avoid flush after every submit.
code just like this:
the one has the issue:
```
while (processed < size) {
while (hash_ctx_processing(ctx)) {
md5_ctx_mgr_flush(mgr);
}
ctx = md5_ctx_mgr_submit(mgr, ctx, chunk, step, flag);
}
while (hash_ctx_processing(ctx) {
md5_ctx_mgr_flush(mgr);
}
Get digest
```
The one has no such issue:
```
while (processed < size) {
ctx = md5_ctx_mgr_submit(mgr, ctx, chunk, step, flag);
while (hash_ctx_processing(ctx)) {
md5_ctx_mgr_flush(mgr);
}
}
Get digest
```
Contributor guide
Assessment
This issue has not been assessed yet.