aboutsummaryrefslogtreecommitdiff
path: root/CPP/Common/XzCrc64Reg.cpp
diff options
context:
space:
mode:
authorIgor Pavlov <87184205+ip7z@users.noreply.github.com>2021-12-27 00:00:00 +0000
committerIgor Pavlov <87184205+ip7z@users.noreply.github.com>2022-03-18 15:35:13 +0500
commitf19f813537c7aea1c20749c914e756b54a9c3cf5 (patch)
tree816ba62ca7c0fa19f2eb46d9e9d6f7dd7c3a744d /CPP/Common/XzCrc64Reg.cpp
parent98e06a519b63b81986abe76d28887f6984a7732b (diff)
download7zip-21.07.tar.gz
7zip-21.07.tar.bz2
7zip-21.07.zip
'21.07'21.07
Diffstat (limited to 'CPP/Common/XzCrc64Reg.cpp')
-rw-r--r--CPP/Common/XzCrc64Reg.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/CPP/Common/XzCrc64Reg.cpp b/CPP/Common/XzCrc64Reg.cpp
new file mode 100644
index 0000000..33b5249
--- /dev/null
+++ b/CPP/Common/XzCrc64Reg.cpp
@@ -0,0 +1,42 @@
1// XzCrc64Reg.cpp
2
3#include "StdAfx.h"
4
5#include "../../C/CpuArch.h"
6#include "../../C/XzCrc64.h"
7
8#include "../Common/MyCom.h"
9
10#include "../7zip/Common/RegisterCodec.h"
11
12class CXzCrc64Hasher:
13 public IHasher,
14 public CMyUnknownImp
15{
16 UInt64 _crc;
17 Byte mtDummy[1 << 7];
18
19public:
20 CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {}
21
22 MY_UNKNOWN_IMP1(IHasher)
23 INTERFACE_IHasher(;)
24};
25
26STDMETHODIMP_(void) CXzCrc64Hasher::Init() throw()
27{
28 _crc = CRC64_INIT_VAL;
29}
30
31STDMETHODIMP_(void) CXzCrc64Hasher::Update(const void *data, UInt32 size) throw()
32{
33 _crc = Crc64Update(_crc, data, size);
34}
35
36STDMETHODIMP_(void) CXzCrc64Hasher::Final(Byte *digest) throw()
37{
38 UInt64 val = CRC64_GET_DIGEST(_crc);
39 SetUi64(digest, val);
40}
41
42REGISTER_HASHER(CXzCrc64Hasher, 0x4, "CRC64", 8)