Merge pull request #901 from ms264556/feature/sha256-quick-fix

Handle XZ CheckType SHA-256
This commit is contained in:
Adam Hathcock
2025-03-07 10:52:24 +00:00
committed by GitHub
2 changed files with 2 additions and 5 deletions

View File

@@ -11,7 +11,7 @@ public class XZHeader
private readonly byte[] MagicHeader = { 0xFD, 0x37, 0x7A, 0x58, 0x5a, 0x00 };
public CheckType BlockCheckType { get; private set; }
public int BlockCheckSize => ((((int)BlockCheckType) + 2) / 3) * 4;
public int BlockCheckSize => 4 << ((((int)BlockCheckType + 2) / 3) - 1);
public XZHeader(BinaryReader reader) => _reader = reader;

View File

@@ -25,13 +25,10 @@ public sealed class XZStream : XZReadOnlyStream
switch (Header.BlockCheckType)
{
case CheckType.NONE:
break;
case CheckType.CRC32:
break;
case CheckType.CRC64:
break;
case CheckType.SHA256:
throw new NotImplementedException();
break;
default:
throw new NotSupportedException("Check Type unknown to this version of decoder.");
}