5752
|
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 |
}
|