EXETOOLS FORUM

EXETOOLS FORUM (https://forum.exetools.com/index.php)
-   Developer Section (https://forum.exetools.com/forumdisplay.php?f=48)
-   -   LZMA1 encoder/decoder (ASM+C) (https://forum.exetools.com/showthread.php?t=17275)

mudlord 12-10-2015 14:25

LZMA1 encoder/decoder (ASM+C)
 
1 Attachment(s)
Ask no questions:
This is the core LZMA depacker and compressor code from the private build of my EXE/DLL packer. Figured it might be useful to some people. Decided not to use LZMA2 since that seems to be just focused on format changes and not actual algorithm changes.

The depacker code is modified from the original to save size and the main compression function focuses on compression ratio.

Example (using lzma.cpp to pack and LzmaDecodeSize.c to depack):
Prototype of decoder is:
Code:

extern "C" { void LzmaDecode(UInt16* workmem,
        const unsigned char *inStream, SizeT inSize,
        unsigned char *outStream, SizeT outSize);
}

Example:
Code:


DWORD compressed;
DWORD original_sz;
BYTE *Original = Load_Input_File("unpacker.bin", &original_sz);
BYTE* compressed_data = compress_lzma(Original, original_sz, &compressed);
PVOID testmem = (unsigned char*)malloc(original_sz);
unsigned char* workmem = (unsigned char*)malloc(0xC4000);
LzmaDecode((UInt16*)workmem, compressed_data + LZMA_PROPS_SIZE, (SizeT)compressed - LZMA_PROPS_SIZE, (unsigned char*)testmem, (SizeT)original_sz);
free(Original);
free(compressed_data);
free(workmem);
free(testmem);

There is a ASM version as well of the C function which is slightly modified for more space savings, which was decompiled from the original MSVC2015 compiled code.

.:hack3r2k:. 04-19-2016 04:41

For some reason i cannot download the attachment. maybe some admin could help ?!

Br;)

CryptXor 04-21-2016 03:32

Quote:

Originally Posted by .:hack3r2k:. (Post 104969)
For some reason i cannot download the attachment. maybe some admin could help ?!

Br;)

You know, if exetools received $0.001 for every time someone asked that question, ZeNiX would be using $100 bills to wipe his ass...

Answer: Search or Read the %^%&*$^ rules: http://forum.exetools.com/showthread.php?t=16581

virus 05-03-2016 07:37

Quote:

Originally Posted by .:hack3r2k:. (Post 104969)
For some reason i cannot download the attachment. maybe some admin could help ?!

Br;)

Grab it from here.

mudlord 05-04-2016 16:53

http://mudlord.info/crap/lzma_decenc.rar

Elesty 11-05-2018 01:11

Hi, the links above are not working anymore. Any chance to share it again on alternative URLs ?

MarcElBichon 11-05-2018 01:40

Quote:

Originally Posted by Elesty (Post 115172)
Hi, the links above are not working anymore. Any chance to share it again on alternative URLs ?

http://rgho.st/7Zrs4yNZB
or better
https://github.com/mudlord/compression_testbed


All times are GMT +8. The time now is 02:43.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Always Your Best Friend: Aaron, JMI, ahmadmansoor, ZeNiX