Jump to content

LZMA Compression UDF


Ward
 Share

Recommended Posts

How to compress data in memory? The simplest way is to use the Native API Compression by trancexx. Here provides another way, using LZMA algorithm. LZMA is the default method of 7z format, provides a high compression ratio and very fast decompression.

In this UDF, embedded and external DLL are both supported. If "LZMA.DLL.AU3" (embedded binary) is not included in scripts, a external LZMA.DLL must exists. You can use external DLL if MemoryDll is not work for you.

Some tips:

  • Both LzmaEnc and LzmaDec only accept binary arguments. To compress string, StringToBinary and BinaryToString can help.
  • LzmaEnc can accept an extra argument, the comression level, from 1 to 9. For example: LzmaEnc($Binary, 9)
  • More settings are support by LzmaEncSetting, please see LZMA SDK.
  • This UDF is not for file compression. To compress files, 7-ZIP UDF is the better choice

Example:

#include "LZMA.AU3"
#include "LZMA.DLL.AU3"

Local $Source = Binary("LZMALZMALZMALZMALZMALZMALZMALZMALZMALZMA")
Local $Compressed = LzmaEnc($Source)
Local $Decompressed = LzmaDec($Compressed)

LZMA.zip

新版 _ArrayAdd 的白痴作者,不管是誰,去死一死好了

 

Link to comment
Share on other sites

  • 1 year later...
  • 5 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...