MXS-1810: Create reset method for Checksum
Resetting checksum calculations avoids some unnecessary calculations when the result is not needed.
This commit is contained in:
parent
050af8fb52
commit
92e0b944a9
@ -377,6 +377,11 @@ public:
|
||||
*/
|
||||
virtual void finalize(GWBUF* buffer = NULL) = 0;
|
||||
|
||||
/**
|
||||
* Reset the checksum to a zero state
|
||||
*/
|
||||
virtual void reset() = 0;
|
||||
|
||||
/**
|
||||
* Get hexadecimal representation of the checksum
|
||||
*
|
||||
@ -411,6 +416,10 @@ public:
|
||||
{
|
||||
update(buffer);
|
||||
SHA1_Final(&m_sum.front(), &m_ctx);
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
SHA1_Init(&m_ctx);
|
||||
}
|
||||
|
||||
@ -464,6 +473,11 @@ public:
|
||||
{
|
||||
update(buffer);
|
||||
m_sum = m_ctx;
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_ctx = crc32(0L, NULL, 0);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user