GrindCore.net is a high-performance, AOT-compatible .NET library that provides managed wrappers for the GrindCore Native library README.md1-3 It is designed to offer a standardized API following the System.IO.Compression style while leveraging modern, native C implementations for compression and hashing README.md38-42
The library addresses performance degradation and outdated implementations by unifying multiple C forks into a single, multi-platform solution README.md40-41
The primary goal of GrindCore.net is to deliver a maintainable compression and hashing solution that ensures byte-perfect output and reliability for projects requiring deterministic results README.md42-45
GrindCore.net bridges the gap between high-level .NET Stream abstractions and low-level native code. The following diagram illustrates the relationship between the managed API and the native interop layer.
Sources: README.md56-67 src/GrindCore.net.csproj89-103 src/Brotli/BrotliEncoder.cs37 src/Brotli/BrotliDecoder.cs27
GrindCore.net targets an extensive range of frameworks and platforms to ensure it can be used in legacy systems and modern cloud-native environments alike. It specifically includes a LINQ bridge for .NET Framework 2.0 support src/GrindCore.net.csproj39-41
| Category | Supported Values |
|---|---|
| .NET Frameworks | .NET 10, 9, 8, 7, 6, 5, Core 3.1, Standard 2.1/2.0, Framework 4.8-3.5, 2.0 |
| Operating Systems | Windows, Linux, macOS |
| Architectures | x64, x86, ARM64, ARM (32-bit) |
Sources: src/GrindCore.net.csproj6-41 README.md49-50
Compression is implemented in two primary forms:
CompressionStream, supporting standard Read/Write operations with added PositionFullSize tracking README.md61-88CompressionBlock, optimized for one-shot buffer processing README.md62For details on usage and patterns, see Getting Started & Quick Start Guide.
The hashing subsystem provides a unified HashAlgorithmGC base class that extends System.Security.Cryptography.HashAlgorithm, making it compatible with CryptoStream README.md92 Supported algorithms include modern standards like Blake3 and XXHash, alongside legacy MD and SHA variants README.md94-99
The library uses a specialized interop layer to manage native resources. For example, the Brotli implementation uses SafeBrotliEncoderHandle and SafeBrotliDecoderHandle to ensure proper resource cleanup via the IDisposable pattern src/Brotli/BrotliEncoder.cs18-85 src/Brotli/BrotliDecoder.cs13-53 Native binaries are packaged within the NuGet under runtimes/ for various RIDs including win-x64, linux-arm64, and osx-arm64 src/GrindCore.net.csproj59-103
Sources: README.md64-67 src/Brotli/BrotliDecoder.cs83 src/Brotli/BrotliEncoder.cs114
The repository is organized into a main library project and several specialized test suites:
GrindCore.net source code, including algorithm-specific folders (e.g., Brotli/, Lzma/).GrindCore.Tests), a reflection-based runtime tester (GrindCore.Tests.Runtime), and stress testing tools (StressLzma) GrindCore.net.sln7-17For details on the build system and project layout, see Project Structure & Build Configuration.