Adler32C Class
Definition
Computes a 32-bit Adler-style checksum using the power-of-two modulus 65536 for SIMD-friendly alignment. This class cannot be inherited.
public sealed class Adler32C : Adler32Base, IResumableHashAlgorithm
- Inheritance
-
Adler32C
- Implements
- Inherited Members
- Extension Methods
-
NonCryptographicHashAlgorithmExtensions.ComputeHash(NonCryptographicHashAlgorithm, byte[], int, int)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], byte[])NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, byte[], string)NonCryptographicHashAlgorithmExtensions.TryVerifyHash(NonCryptographicHashAlgorithm, Stream, byte[])
Remarks
This variant maintains two running sums (A and B) and combines them as (B << 16) | A, but uses a
modulus of 65536 rather than the standard 65521 to enable cheaper modular reductions in vectorized code paths.
Outputs differ from standard Adler32 and are not interchangeable.
Parameters at a glance.
- Output size: 32 bits (4 bytes).
- Modulus:
65536(power of two; SIMD-friendly). - Compatibility: not interchangeable with Adler32 outputs.
When to choose Adler32C. Pick Adler32C when both endpoints are under your control and SIMD throughput on the modular-reduction step is the bottleneck - large in-memory streams, internal block-level integrity checks, content-defined chunking. For any boundary that interoperates with zlib, deflate, gzip, PNG, or other external systems, use Adler32 instead - its output is the only one those systems will accept.
important
This algorithm is not cryptographically secure and should not be used for password hashing, digital signatures, or integrity validation in security-sensitive applications.
using Bodu.IO.Hashing.Checksums;
using Bodu.IO.Hashing.Extensions;
// SIMD-friendly Adler variant for high-throughput internal pipelines.
var adler = new Adler32C();
byte[] checksum = adler.ComputeHash(largeBlock);
Constructors
Adler32C()
Initializes a new instance of the Adler32C class using the SIMD-friendly modulus (65536).
public Adler32C()
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |