Add SHA-256 checksum calculation support

This commit is contained in:
2025-10-03 02:03:39 +01:00
parent 1e569c68a1
commit 79ac2e380c
10 changed files with 329 additions and 124 deletions

View File

@@ -156,6 +156,8 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative
if(ctx->calculating_md5) ctx->calculating_md5 = false;
// Disable SHA1 calculation
if(ctx->calculating_sha1) ctx->calculating_sha1 = false;
// Disable SHA256 calculation
if(ctx->calculating_sha256) ctx->calculating_sha256 = false;
}
else
ctx->last_written_block = sector_address;
@@ -167,6 +169,9 @@ int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative
// Calculate SHA1 on-the-fly if requested and sector is within user sectors (not negative or overflow)
if(ctx->calculating_sha1 && !negative && sector_address <= ctx->imageInfo.Sectors)
aaruf_sha1_update(&ctx->sha1_context, data, length);
// Calculate SHA256 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_sha256_update(&ctx->sha256_context, data, length);
// TODO: If optical disc check track