Files
easy7zip/CPP/Common/XXH32Reg.cpp
Tino Reichardt e19abb2958 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:
commit add56b5aed
Author: Tino Reichardt <milky-7zip@mcmilk.de>
Date:   Thu Nov 1 23:08:00 2018 +0100

    Add MD5 hash function

commit 36a17a5184
Author: 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

commit 576c5df947
Author: Tino Reichardt <milky-7zip@mcmilk.de>
Date:   Tue Apr 6 19:35:46 2021 +0200

    Add BLAKE3 hash function

commit 6b2a151549
Author: Tino Reichardt <milky-7zip@mcmilk.de>
Date:   Tue Apr 6 19:51:01 2021 +0200

    Remove unneeded file HashesReg.cpp

commit dddf507557
Author: 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.
2024-05-13 22:20:40 +08:00

48 lines
994 B
C++

// XXH32Reg.cpp /TR 2018-11-02
#include "StdAfx.h"
#include "../../C/CpuArch.h"
#define XXH_STATIC_LINKING_ONLY
// shunf4: no zstd, comment for now
// #include "../../C/zstd/xxhash.h"
#include "../Common/MyCom.h"
#include "../7zip/Common/RegisterCodec.h"
// XXH32
Z7_CLASS_IMP_COM_1(CXXH32Hasher, IHasher)
// XXH32_state_t *_ctx;
void *_ctx;
Byte mtDummy[1 << 7];
public:
// CXXH32Hasher() { _ctx = XXH32_createState(); }
CXXH32Hasher() { _ctx = NULL; }
// ~CXXH32Hasher() { XXH32_freeState(_ctx); }
~CXXH32Hasher() { }
};
STDMETHODIMP_(void) CXXH32Hasher::Init() throw()
{
// XXH32_reset(_ctx, 0);
}
STDMETHODIMP_(void) CXXH32Hasher::Update(const void *data, UInt32 size) throw()
{
(void)(data);
(void)(size);
// XXH32_update(_ctx, data, size);
}
STDMETHODIMP_(void) CXXH32Hasher::Final(Byte *digest) throw()
{
(void)(digest);
// UInt32 val = XXH32_digest(_ctx);
// SetUi32(digest, val);
}
REGISTER_HASHER(CXXH32Hasher, 0x20d, "XXH32 (NOT WORKING)", 4)