mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-11 00:07:09 -06:00
shunf4 cherry-picking hash related commits from zstd. The following commits from 7-zip-zstd repository (https://github.com/mcmilk/7-Zip-zstd) is picked:
commitadd56b5aedAuthor: Tino Reichardt <milky-7zip@mcmilk.de> Date: Thu Nov 1 23:08:00 2018 +0100 Add MD5 hash function commit36a17a5184Author: Tino Reichardt <milky-7zip@mcmilk.de> Date: Sat Nov 3 00:18:33 2018 +0100 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 commit576c5df947Author: Tino Reichardt <milky-7zip@mcmilk.de> Date: Tue Apr 6 19:35:46 2021 +0200 Add BLAKE3 hash function commit6b2a151549Author: Tino Reichardt <milky-7zip@mcmilk.de> Date: Tue Apr 6 19:51:01 2021 +0200 Remove unneeded file HashesReg.cpp commitdddf507557Author: Tino Reichardt <milky-7zip@mcmilk.de> Date: Sun Jun 18 09:13:59 2023 +0200 Add SHA3 hashing - added these variants: SHA3-256, SHA3-384, SHA3-512 - reordered also the hashing id's - added some notes about them in DOC/Hashes.txt Signed-off-by: Tino Reichardt <milky-7zip@mcmilk.de> The cherry-picking was a chaos; they're not applied in order, and some commits even got cherry-picked twice (1->4->0->2->4->3). So subsequent fixes and adjustments were applied to make it build.
This commit is contained in:
39
CPP/Common/Md5Reg.cpp
Normal file
39
CPP/Common/Md5Reg.cpp
Normal file
@@ -0,0 +1,39 @@
|
||||
// MD5Reg.cpp
|
||||
|
||||
#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
|
||||
Z7_CLASS_IMP_COM_1(CMD5Hasher, IHasher)
|
||||
MD5_CTX _ctx;
|
||||
Byte mtDummy[1 << 7];
|
||||
|
||||
public:
|
||||
CMD5Hasher() { MD5_Init(&_ctx); }
|
||||
|
||||
};
|
||||
|
||||
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