-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e403be
commit 1a4e078
Showing
6 changed files
with
1,134 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
PROG = Blake3 | ||
DEF_FILE = ../Codec.def | ||
|
||
# IS_X64 = 1 | ||
# USE_ASM = 1 | ||
# ST_MODE = 1 | ||
|
||
ifdef SystemDrive | ||
|
||
LOCAL_FLAGS_WIN = \ | ||
-D_7ZIP_LARGE_PAGES \ | ||
$(LOCAL_FLAGS_ST) \ | ||
|
||
SYS_OBJS = \ | ||
|
||
else | ||
|
||
SYS_OBJS = \ | ||
$O/MyWindows.o \ | ||
|
||
endif | ||
|
||
LOCAL_FLAGS = \ | ||
-DEXTERNAL_CODECS \ | ||
$(LOCAL_FLAGS_WIN) \ | ||
$(LOCAL_FLAGS_ST) \ | ||
|
||
COMPRESS_OBJS_2 = \ | ||
$O/CodecExports.o \ | ||
$O/DllExportsCompress.o \ | ||
$O/Blake3Reg.o \ | ||
$O/blake3.o \ | ||
|
||
OBJS = \ | ||
$(COMPRESS_OBJS_2) \ | ||
$(SYS_OBJS) \ | ||
$(COMMON_OBJS) \ | ||
|
||
include ../../7zip_gcc.mak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Blake3Reg.cpp /TR 2021-04-06 | ||
|
||
#include "StdAfx.h" | ||
|
||
#include "../../C/CpuArch.h" | ||
|
||
EXTERN_C_BEGIN | ||
#include "../../Codecs/hashes/blake3.h" | ||
EXTERN_C_END | ||
|
||
#include "../Common/MyCom.h" | ||
#include "../7zip/Common/RegisterCodec.h" | ||
|
||
// BLAKE3 | ||
class CBLAKE3Hasher: | ||
public IHasher, | ||
public CMyUnknownImp | ||
{ | ||
blake3_hasher _ctx; | ||
Byte mtDummy[1 << 7]; | ||
|
||
public: | ||
CBLAKE3Hasher() { blake3_hasher_init(&_ctx); } | ||
|
||
MY_UNKNOWN_IMP1(IHasher) | ||
INTERFACE_IHasher(;) | ||
}; | ||
|
||
STDMETHODIMP_(void) CBLAKE3Hasher::Init() throw() | ||
{ | ||
blake3_hasher_init(&_ctx); | ||
} | ||
|
||
STDMETHODIMP_(void) CBLAKE3Hasher::Update(const void *data, UInt32 size) throw() | ||
{ | ||
blake3_hasher_update(&_ctx, data, size); | ||
} | ||
|
||
STDMETHODIMP_(void) CBLAKE3Hasher::Final(Byte *digest) throw() | ||
{ | ||
blake3_hasher_finalize(&_ctx, digest, BLAKE3_OUT_LEN); | ||
} | ||
REGISTER_HASHER(CBLAKE3Hasher, 0x20a, "BLAKE3", BLAKE3_OUT_LEN) |
Oops, something went wrong.