Skip to content

Add FIPS-compliant hash algorithm support#338

Open
sxndmxn wants to merge 3 commits intolecaillon:masterfrom
sxndmxn:feature/fips-compliant-hash-algorithms
Open

Add FIPS-compliant hash algorithm support#338
sxndmxn wants to merge 3 commits intolecaillon:masterfrom
sxndmxn:feature/fips-compliant-hash-algorithms

Conversation

@sxndmxn
Copy link

@sxndmxn sxndmxn commented Jan 13, 2026

Summary

  • Add configurable hash algorithms (SHA-256, SHA-384, SHA-512) for FIPS compliance
  • Maintain backward compatibility with existing MD5 checksums through dual validation
  • Add --checksum-algorithm CLI option

Changes

  • Add HashAlgorithmType enum (MD5, SHA256, SHA384, SHA512)
  • Add ChecksumCalculator utility for centralized hash calculation
  • Add ChecksumAlgorithm configuration property (default: MD5)
  • Implement dual validation in MigrationScript.ValidateChecksum()
  • Expand metadata table checksum column from VARCHAR(32) to VARCHAR(128)
  • Update target framework to .NET 10

Test plan

  • All existing unit tests pass (63 tests)
  • New ChecksumCalculatorTest tests added
  • Dual validation tests added to FileMigrationScriptTest
  • Manual testing with SQLite database
  • Test FIPS mode on Windows 11

Add configurable hash algorithms (SHA-256, SHA-384, SHA-512) for FIPS
compliance while maintaining backward compatibility with existing MD5
checksums through dual validation.

Changes:
- Add HashAlgorithmType enum (MD5, SHA256, SHA384, SHA512)
- Add ChecksumCalculator utility for centralized hash calculation
- Add ChecksumAlgorithm configuration property (default: MD5)
- Implement dual validation in MigrationScript.ValidateChecksum()
- Expand metadata table checksum column from VARCHAR(32) to VARCHAR(128)
- Add --checksum-algorithm CLI option
- Update target framework to .NET 10
Replace custom HashAlgorithmType enum with .NET's built-in
HashAlgorithmName struct for better alignment with .NET conventions
and improved extensibility.

Changes:
- Delete HashAlgorithmType.cs custom enum
- Use System.Security.Cryptography.HashAlgorithmName throughout
- Use CryptographicOperations.HashData() for modern, efficient hashing
- CLI option accepts string and converts to HashAlgorithmName
- Update all tests to use HashAlgorithmName

Benefits:
- Uses official .NET cryptography pattern
- Extensible for future algorithms via HashAlgorithmName constructor
- Better FIPS mode handling (automatic)
- Works with modern .NET crypto APIs
Remove [AllowedValues] restriction and use HashAlgorithmName constructor
directly to accept any system-supported hash algorithm.

The runtime will validate algorithm support via CryptographicOperations.
HashData(), throwing CryptographicException for unsupported algorithms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant