1370b324cSopenharmony_ci// XzCrc64Reg.cpp 2370b324cSopenharmony_ci 3370b324cSopenharmony_ci#include "StdAfx.h" 4370b324cSopenharmony_ci 5370b324cSopenharmony_ci#include "../../C/CpuArch.h" 6370b324cSopenharmony_ci#include "../../C/XzCrc64.h" 7370b324cSopenharmony_ci 8370b324cSopenharmony_ci#include "../Common/MyCom.h" 9370b324cSopenharmony_ci 10370b324cSopenharmony_ci#include "../7zip/Common/RegisterCodec.h" 11370b324cSopenharmony_ci 12370b324cSopenharmony_ciZ7_CLASS_IMP_COM_1( 13370b324cSopenharmony_ci CXzCrc64Hasher 14370b324cSopenharmony_ci , IHasher 15370b324cSopenharmony_ci) 16370b324cSopenharmony_ci UInt64 _crc; 17370b324cSopenharmony_cipublic: 18370b324cSopenharmony_ci Byte _mtDummy[1 << 7]; // it's public to eliminate clang warning: unused private field 19370b324cSopenharmony_ci 20370b324cSopenharmony_ci CXzCrc64Hasher(): _crc(CRC64_INIT_VAL) {} 21370b324cSopenharmony_ci}; 22370b324cSopenharmony_ci 23370b324cSopenharmony_ciZ7_COM7F_IMF2(void, CXzCrc64Hasher::Init()) 24370b324cSopenharmony_ci{ 25370b324cSopenharmony_ci _crc = CRC64_INIT_VAL; 26370b324cSopenharmony_ci} 27370b324cSopenharmony_ci 28370b324cSopenharmony_ciZ7_COM7F_IMF2(void, CXzCrc64Hasher::Update(const void *data, UInt32 size)) 29370b324cSopenharmony_ci{ 30370b324cSopenharmony_ci _crc = Crc64Update(_crc, data, size); 31370b324cSopenharmony_ci} 32370b324cSopenharmony_ci 33370b324cSopenharmony_ciZ7_COM7F_IMF2(void, CXzCrc64Hasher::Final(Byte *digest)) 34370b324cSopenharmony_ci{ 35370b324cSopenharmony_ci const UInt64 val = CRC64_GET_DIGEST(_crc); 36370b324cSopenharmony_ci SetUi64(digest, val) 37370b324cSopenharmony_ci} 38370b324cSopenharmony_ci 39370b324cSopenharmony_ciREGISTER_HASHER(CXzCrc64Hasher, 0x4, "CRC64", 8) 40