Add support for on-the-fly BLAKE3 checksum calculation

This commit is contained in:
2025-10-03 04:01:30 +01:00
parent 5a8a8c630f
commit 506b153930
5 changed files with 80 additions and 16 deletions

View File

@@ -160,6 +160,8 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative
if(ctx->calculating_sha256) ctx->calculating_sha256 = false;
// Disable SpamSum calculation
if(ctx->calculating_spamsum) ctx->calculating_spamsum = false;
// Disable BLAKE3 calculation
if(ctx->calculating_blake3) ctx->calculating_blake3 = false;
}
else
ctx->last_written_block = sector_address;
@@ -176,7 +178,10 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative
aaruf_sha256_update(&ctx->sha256_context, data, length);
// Calculate SpamSum on-the-fly if requested and sector is within user sectors (not negative or overflow)
if(ctx->calculating_sha256 && !negative && sector_address <= ctx->imageInfo.Sectors)
aaruf_spamsum_update(&ctx->spamsum_context, data, length);
aaruf_spamsum_update(ctx->spamsum_context, data, length);
// Calculate BLAKE3 on-the-fly if requested and sector is within user sectors (not negative or overflow)
if(ctx->calculating_blake3 && !negative && sector_address <= ctx->imageInfo.Sectors)
blake3_hasher_update(ctx->blake3_context, data, length);
// TODO: If optical disc check track