-
Notifications
You must be signed in to change notification settings - Fork 0
Add ZIP and TAR format support, fix StringIO bug, and improve thread safety #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jkorany
wants to merge
1
commit into
main
Choose a base branch
from
multi-format-support-and-fixes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,105 @@ | ||
| /* Blake2.h -- BLAKE2sp Hash | ||
| 2024-01-17 : Igor Pavlov : Public domain */ | ||
|
|
||
| #ifndef ZIP7_INC_BLAKE2_H | ||
| #define ZIP7_INC_BLAKE2_H | ||
|
|
||
| #include "7zTypes.h" | ||
|
|
||
| #if 0 | ||
| #include "Compiler.h" | ||
| #include "CpuArch.h" | ||
| #if defined(MY_CPU_X86_OR_AMD64) | ||
| #if defined(__SSE2__) \ | ||
| || defined(_MSC_VER) && _MSC_VER > 1200 \ | ||
| || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 30300) \ | ||
| || defined(__clang__) \ | ||
| || defined(__INTEL_COMPILER) | ||
| #include <emmintrin.h> // SSE2 | ||
| #endif | ||
|
|
||
| #if defined(__AVX2__) \ | ||
| || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \ | ||
| || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 40600) \ | ||
| || defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30100) \ | ||
| || defined(Z7_MSC_VER_ORIGINAL) && (Z7_MSC_VER_ORIGINAL >= 1800) \ | ||
| || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400) | ||
| #include <immintrin.h> | ||
| #if defined(__clang__) | ||
| #include <avxintrin.h> | ||
| #include <avx2intrin.h> | ||
| #endif | ||
| #endif // avx2 | ||
| #endif // MY_CPU_X86_OR_AMD64 | ||
| #endif // 0 | ||
|
|
||
| EXTERN_C_BEGIN | ||
|
|
||
| #define Z7_BLAKE2S_BLOCK_SIZE 64 | ||
| #define Z7_BLAKE2S_DIGEST_SIZE 32 | ||
| #define Z7_BLAKE2SP_PARALLEL_DEGREE 8 | ||
| #define Z7_BLAKE2SP_NUM_STRUCT_WORDS 16 | ||
|
|
||
| #if 1 || defined(Z7_BLAKE2SP_USE_FUNCTIONS) | ||
| typedef void (Z7_FASTCALL *Z7_BLAKE2SP_FUNC_COMPRESS)(UInt32 *states, const Byte *data, const Byte *end); | ||
| typedef void (Z7_FASTCALL *Z7_BLAKE2SP_FUNC_INIT)(UInt32 *states); | ||
| #endif | ||
|
|
||
| // it's required that CBlake2sp is aligned for 32-bytes, | ||
| // because the code can use unaligned access with sse and avx256. | ||
| // but 64-bytes alignment can be better. | ||
| MY_ALIGN(64) | ||
| typedef struct | ||
| { | ||
| union | ||
| { | ||
| #if 0 | ||
| #if defined(MY_CPU_X86_OR_AMD64) | ||
| #if defined(__SSE2__) \ | ||
| || defined(_MSC_VER) && _MSC_VER > 1200 \ | ||
| || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 30300) \ | ||
| || defined(__clang__) \ | ||
| || defined(__INTEL_COMPILER) | ||
| __m128i _pad_align_128bit[4]; | ||
| #endif // sse2 | ||
| #if defined(__AVX2__) \ | ||
| || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \ | ||
| || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 40600) \ | ||
| || defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30100) \ | ||
| || defined(Z7_MSC_VER_ORIGINAL) && (Z7_MSC_VER_ORIGINAL >= 1800) \ | ||
| || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400) | ||
| __m256i _pad_align_256bit[2]; | ||
| #endif // avx2 | ||
| #endif // x86 | ||
| #endif // 0 | ||
|
|
||
| void * _pad_align_ptr[8]; | ||
| UInt32 _pad_align_32bit[16]; | ||
| struct | ||
| { | ||
| unsigned cycPos; | ||
| unsigned _pad_unused; | ||
| #if 1 || defined(Z7_BLAKE2SP_USE_FUNCTIONS) | ||
| Z7_BLAKE2SP_FUNC_COMPRESS func_Compress_Fast; | ||
| Z7_BLAKE2SP_FUNC_COMPRESS func_Compress_Single; | ||
| Z7_BLAKE2SP_FUNC_INIT func_Init; | ||
| Z7_BLAKE2SP_FUNC_INIT func_Final; | ||
| #endif | ||
| } header; | ||
| } u; | ||
| // MY_ALIGN(64) | ||
| UInt32 states[Z7_BLAKE2SP_PARALLEL_DEGREE * Z7_BLAKE2SP_NUM_STRUCT_WORDS]; | ||
| // MY_ALIGN(64) | ||
| UInt32 buf32[Z7_BLAKE2SP_PARALLEL_DEGREE * Z7_BLAKE2SP_NUM_STRUCT_WORDS * 2]; | ||
| } CBlake2sp; | ||
|
|
||
| BoolInt Blake2sp_SetFunction(CBlake2sp *p, unsigned algo); | ||
| void Blake2sp_Init(CBlake2sp *p); | ||
| void Blake2sp_InitState(CBlake2sp *p); | ||
| void Blake2sp_Update(CBlake2sp *p, const Byte *data, size_t size); | ||
| void Blake2sp_Final(CBlake2sp *p, Byte *digest); | ||
| void z7_Black2sp_Prepare(void); | ||
|
|
||
| EXTERN_C_END | ||
|
|
||
| #endif | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This directory contains lzma_sdk files that were added for Zip support - ignore the source changes in
lzma_sdk(unless you want to learn more about 7zip's SDK)