mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 16:07:10 -06:00
Add some hash functions
- new: md2, md4, md5, sha384, sha512, xxhash-32, xxhash-64 - put Blake2sp hash stuff back to rar code - added the hashes to GUI and Explorer Menu code
This commit is contained in:
43
CPP/Common/Md5Reg.cpp
Normal file
43
CPP/Common/Md5Reg.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// Md5Reg.cpp /TR 2018-11-02
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../C/CpuArch.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
#include "../../C/hashes/md5.h"
|
||||
EXTERN_C_END
|
||||
|
||||
#include "../Common/MyCom.h"
|
||||
#include "../7zip/Common/RegisterCodec.h"
|
||||
|
||||
// MD5
|
||||
class CMD5Hasher:
|
||||
public IHasher,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
MD5_CTX _ctx;
|
||||
Byte mtDummy[1 << 7];
|
||||
|
||||
public:
|
||||
CMD5Hasher() { MD5_Init(&_ctx); }
|
||||
|
||||
MY_UNKNOWN_IMP1(IHasher)
|
||||
INTERFACE_IHasher(;)
|
||||
};
|
||||
|
||||
STDMETHODIMP_(void) CMD5Hasher::Init() throw()
|
||||
{
|
||||
MD5_Init(&_ctx);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) CMD5Hasher::Update(const void *data, UInt32 size) throw()
|
||||
{
|
||||
MD5_Update(&_ctx, (const Byte *)data, size);
|
||||
}
|
||||
|
||||
STDMETHODIMP_(void) CMD5Hasher::Final(Byte *digest) throw()
|
||||
{
|
||||
MD5_Final(digest, &_ctx);
|
||||
}
|
||||
REGISTER_HASHER(CMD5Hasher, 0x207, "MD5", MD5_DIGEST_LENGTH)
|
||||
Reference in New Issue
Block a user