{"id":18705136,"url":"https://github.com/wabzsy/compression","last_synced_at":"2025-04-12T10:07:10.128Z","repository":{"id":183826057,"uuid":"670796112","full_name":"wabzsy/compression","owner":"wabzsy","description":"aPLib/LZNT1/XPRESS compression library implemented in pure Go","archived":false,"fork":false,"pushed_at":"2024-06-04T14:59:12.000Z","size":31,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T10:05:33.596Z","etag":null,"topics":["aplib","aplib-format","compression-library","golang","lznt1","xpress"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wabzsy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-25T21:26:08.000Z","updated_at":"2024-09-09T03:30:34.000Z","dependencies_parsed_at":"2024-06-04T16:43:33.704Z","dependency_job_id":"55b09f32-ed55-41d8-9c46-8f0f0aeae5e6","html_url":"https://github.com/wabzsy/compression","commit_stats":null,"previous_names":["wabzsy/compression"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabzsy%2Fcompression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabzsy%2Fcompression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabzsy%2Fcompression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wabzsy%2Fcompression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wabzsy","download_url":"https://codeload.github.com/wabzsy/compression/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248550633,"owners_count":21122933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aplib","aplib-format","compression-library","golang","lznt1","xpress"],"created_at":"2024-11-07T12:09:48.387Z","updated_at":"2025-04-12T10:07:10.101Z","avatar_url":"https://github.com/wabzsy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Compression\n\n[English](README.md) | [中文](README_zh.md)\n\n`Compression` is a compression (decompression) library implemented in pure Go. It is mainly used to support some non-mainstream compression formats (such as: aPLib, LZNT1, Xpress). It can be used as a module or as a stand-alone CLI tool.\n\n## Directory Structure\n\n| Directory | Description                                                  |\n| --------- | ------------------------------------------------------------ |\n| aplib     | Process data in aPLib format, support aPLib header           |\n| lznt1     | Process data in COMPRESSION_FORMAT_LZNT1 format of RtlCompressBuffer |\n| xpress    | Process data in COMPRESSION_FORMAT_XPRESS format of RtlCompressBuffer |\n| rtl       | Use syscall to call the compression (decompression) function in ntdll.dll, **only supported on Windows platform** |\n| example   | A simple CLI tool, see below for usage                       |\n| testdata  | Empty                                                        |\n\n## Usage\n\n### Use as module\n\n```bash\ngo get -v -u github.com/wabzsy/compression\n```\n\n```go\npackage example\n\nimport \"github.com/wabzsy/compression\"\n\nfunc example() {\n\tinput := []byte(\"abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc\")\n\n\t// aPLib Compress without header (golang)\n\tresult, err := compression.APLibCompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// aPLib Compress with header (golang)\n\tresult, err = compression.APLibSafeCompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// aPLib Decompress with strict mode (golang)\n\tresult, err = compression.APLibStrictDecompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// LZNT1 Compress (golang)\n\tresult, err = compression.LZNT1Compress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// LZNT1 Decompress (golang)\n\tresult, err = compression.LZNT1Decompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Xpress Compress (golang)\n\tresult, err = compression.XPressCompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Xpress Decompress (golang)\n\tresult, err = compression.XPressDecompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// RtlCompressBuffer (COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM) -- Windows only\n\tresult, err = compression.RtlLZNT1Compress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// RtlDecompressBuffer (COMPRESSION_FORMAT_LZNT1) -- Windows only\n\tresult, err = compression.RtlLZNT1Decompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// RtlCompressBuffer (COMPRESSION_FORMAT_XPRESS | COMPRESSION_ENGINE_MAXIMUM) -- Windows only\n\tresult, err = compression.RtlXPressCompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// RtlDecompressBuffer (COMPRESSION_FORMAT_XPRESS)  -- Windows only\n\tresult, err = compression.RtlXPressDecompress(input)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n\n```\n\n### Use as a CLI tool\n\n- clone the source code and compile:\n\n```bash\ngit clone https://github.com/wabzsy/compression\n\ncd compression/example\n\ngo build -v -o cli\n```\n\n- show `cli` usage:\n\n```bash\n./cli -h\n```\n\n```\nUsage of ./cli:\n  -i string\n        input file\n  -m int\n        mode:\n          1: aPLib Compress without header (golang)\n          2: aPLib Compress with header (golang)\n          3: aPLib Decompress with strict mode (golang)\n          4: LZNT1 Compress (golang)\n          5: LZNT1 Decompress (golang)\n          6: RtlCompressBuffer (COMPRESSION_FORMAT_LZNT1 | COMPRESSION_ENGINE_MAXIMUM)\n          7: RtlDecompressBuffer (COMPRESSION_FORMAT_LZNT1)\n          8: Xpress Compress (golang)\n          9: Xpress Decompress (golang)\n          10: RtlCompressBuffer (COMPRESSION_FORMAT_XPRESS | COMPRESSION_ENGINE_MAXIMUM)\n          11: RtlDecompressBuffer (COMPRESSION_FORMAT_XPRESS)\n        \n  -o string\n        output file\n```\n\n- example of input/output:\n\n```bash\n# Xpress Compress \n./cli -i ../testdata/test.exe -o ../testdata/test.bin -m 8\n```\n\n```\n2023/07/26 06:59:19 elapsed time: 1.217532875s\n2023/07/26 06:59:19 input length: 7905792\n2023/07/26 06:59:19 input sha1: 02584ea42efe09e83e9093e1e76ec319930a55c3\n2023/07/26 06:59:19 output length: 3833366\n2023/07/26 06:59:19 output sha1: 0a07eb4e0ddac9864125f319eaac43488bef90e4\n```\n\n```bash\n# Xpress Decompress \n./cli -i ../testdata/test.bin -o ../testdata/test.dec -m 9\n```\n\n```\n2023/07/26 07:00:33 elapsed time: 56.612625ms\n2023/07/26 07:00:33 input length: 3833366\n2023/07/26 07:00:33 input sha1: 0a07eb4e0ddac9864125f319eaac43488bef90e4\n2023/07/26 07:00:33 output length: 7905792\n2023/07/26 07:00:33 output sha1: 02584ea42efe09e83e9093e1e76ec319930a55c3\n```\n\n## References \u0026 Links\n\nhttps://learn.microsoft.com/en-us/openspecs/windows_protocols/ms-xca/a8b7cb0a-92a6-4187-a23b-5e14273b96f8\n\nhttps://ibsensoftware.com/products_aPLib.html\n\nhttps://github.com/coderforlife/ms-compress C++\n\nhttps://github.com/emmanuel-marty/apultra - C\n\nhttps://github.com/li-xilin/lznt1 - C\n\nhttps://github.com/svendahl/cap - C#\n\nhttps://github.com/you0708/lznt1 - Python\n\nhttps://github.com/nma-io/refinery - Python\n\nhttps://github.com/snemes/kabopan - Python\n\nhttps://github.com/snemes/aplib - Python\n\nhttps://github.com/herrcore/aplib-ripper - Python\n\nhttps://github.com/CERT-Polska/malduck - Python\n\nhttps://github.com/killeven/lznt1 - Golang\n\nhttps://github.com/hatching/aplib - Golang\n\nhttps://github.com/julyanserra/Basic-LZ77-in-Python\n\nhttps://github.com/SirusDoma/klz77\n\nhttps://github.com/fbonhomm/LZ77\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabzsy%2Fcompression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwabzsy%2Fcompression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwabzsy%2Fcompression/lists"}