mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-12 22:11:35 -06:00
Add Blake2s to CPP/Common
- was in the Rar5 Code
This commit is contained in:
@@ -2963,34 +2963,3 @@ REGISTER_ARC_I(
|
|||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
||||||
class CBlake2spHasher:
|
|
||||||
public IHasher,
|
|
||||||
public CMyUnknownImp
|
|
||||||
{
|
|
||||||
CBlake2sp _blake;
|
|
||||||
Byte mtDummy[1 << 7];
|
|
||||||
|
|
||||||
public:
|
|
||||||
CBlake2spHasher() { Init(); }
|
|
||||||
|
|
||||||
MY_UNKNOWN_IMP
|
|
||||||
INTERFACE_IHasher(;)
|
|
||||||
};
|
|
||||||
|
|
||||||
STDMETHODIMP_(void) CBlake2spHasher::Init() throw()
|
|
||||||
{
|
|
||||||
Blake2sp_Init(&_blake);
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(void) CBlake2spHasher::Update(const void *data, UInt32 size) throw()
|
|
||||||
{
|
|
||||||
Blake2sp_Update(&_blake, (const Byte *)data, size);
|
|
||||||
}
|
|
||||||
|
|
||||||
STDMETHODIMP_(void) CBlake2spHasher::Final(Byte *digest) throw()
|
|
||||||
{
|
|
||||||
Blake2sp_Final(&_blake, digest);
|
|
||||||
}
|
|
||||||
|
|
||||||
REGISTER_HASHER(CBlake2spHasher, 0x202, "BLAKE2sp", BLAKE2S_DIGEST_SIZE)
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
COMMON_OBJS = \
|
COMMON_OBJS = \
|
||||||
|
$O\Blake2sReg.obj \
|
||||||
$O\CRC.obj \
|
$O\CRC.obj \
|
||||||
$O\CrcReg.obj \
|
$O\CrcReg.obj \
|
||||||
$O\DynLimBuf.obj \
|
$O\DynLimBuf.obj \
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
COMMON_OBJS = \
|
COMMON_OBJS = \
|
||||||
|
$O\Blake2sReg.obj \
|
||||||
$O\CRC.obj \
|
$O\CRC.obj \
|
||||||
$O\CrcReg.obj \
|
$O\CrcReg.obj \
|
||||||
$O\DynLimBuf.obj \
|
$O\DynLimBuf.obj \
|
||||||
|
|||||||
43
CPP/Common/Blake2sReg.cpp
Normal file
43
CPP/Common/Blake2sReg.cpp
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
// Blake2sReg.cpp
|
||||||
|
|
||||||
|
#include "StdAfx.h"
|
||||||
|
|
||||||
|
#define XXH_STATIC_LINKING_ONLY
|
||||||
|
#include "../../C/CpuArch.h"
|
||||||
|
#include "../../C/Blake2.h"
|
||||||
|
|
||||||
|
#include "../Common/MyCom.h"
|
||||||
|
|
||||||
|
#include "../7zip/Common/RegisterCodec.h"
|
||||||
|
|
||||||
|
|
||||||
|
class CBlake2spHasher:
|
||||||
|
public IHasher,
|
||||||
|
public CMyUnknownImp
|
||||||
|
{
|
||||||
|
CBlake2sp _blake;
|
||||||
|
Byte mtDummy[1 << 7];
|
||||||
|
|
||||||
|
public:
|
||||||
|
CBlake2spHasher() { Init(); }
|
||||||
|
|
||||||
|
MY_UNKNOWN_IMP
|
||||||
|
INTERFACE_IHasher(;)
|
||||||
|
};
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) CBlake2spHasher::Init() throw()
|
||||||
|
{
|
||||||
|
Blake2sp_Init(&_blake);
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) CBlake2spHasher::Update(const void *data, UInt32 size) throw()
|
||||||
|
{
|
||||||
|
Blake2sp_Update(&_blake, (const Byte *)data, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
STDMETHODIMP_(void) CBlake2spHasher::Final(Byte *digest) throw()
|
||||||
|
{
|
||||||
|
Blake2sp_Final(&_blake, digest);
|
||||||
|
}
|
||||||
|
|
||||||
|
REGISTER_HASHER(CBlake2spHasher, 0x202, "BLAKE2sp", BLAKE2S_DIGEST_SIZE)
|
||||||
Reference in New Issue
Block a user