Adler32 is another checksum algorithm that is used as a "quick and dirty" version of the CRC32 algorithm (it was developed by Mark Adler from Fletcher's checksum).
You get a single 32-bit number that represents a block of data (of any size but >128 bytes preferably).
If the data changes in any way (even a single bit) the Adler32 calculation would yield a completely different value.
Usage:
int Adler32=CAdler32().From(Buffer,Size);
or use one instance for several Adler32s:
CAdler32 Adler32;
int Adler32a=Adler32.From(Buffer1,Size1);
int Adler32b=Adler32.From(Buffer2,Size2);
or if reading a file in blocks:
CAdler32 Adler32;
while(Read(Buffer, Size)) Adler32.From(Buffer, Size, true);
int MyAdler32=Adler32.GetAdler32();
Test Vectors used in the tester are generated from the RFC1950 C implementation. There are no official test vectors.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS'
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.