misc/quazip/quaadler32.cpp
changeset 8057 93e16240f178
parent 8051 f26422ef0333
parent 8055 04dd8b7fb605
child 8058 bcebfc477459
equal deleted inserted replaced
8051:f26422ef0333 8057:93e16240f178
     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 }