misc/quazip/quaadler32.cpp
branchhedgeroid
changeset 5824 2e5835130d9a
parent 5752 ea95ee97c805
equal deleted inserted replaced
5733:5ab22736bdb6 5824:2e5835130d9a
       
     1 #include "quaadler32.h"
       
     2 
       
     3 #include "zlib.h"
       
     4 
       
     5 QuaAdler32::QuaAdler32()
       
     6 {
       
     7 	reset();
       
     8 }
       
     9 
       
    10 quint32 QuaAdler32::calculate(const QByteArray &data)
       
    11 {
       
    12 	return adler32( adler32(0L, Z_NULL, 0), (const Bytef*)data.data(), data.size() );
       
    13 }
       
    14 
       
    15 void QuaAdler32::reset()
       
    16 {
       
    17 	checksum = adler32(0L, Z_NULL, 0);
       
    18 }
       
    19 
       
    20 void QuaAdler32::update(const QByteArray &buf)
       
    21 {
       
    22 	checksum = adler32( checksum, (const Bytef*)buf.data(), buf.size() );
       
    23 }
       
    24 
       
    25 quint32 QuaAdler32::value()
       
    26 {
       
    27 	return checksum;
       
    28 }