Recent

Author Topic: LZ-String compress decompress  (Read 420 times)

dkur

  • Newbie
  • Posts: 3
LZ-String compress decompress
« on: July 22, 2022, 09:31:07 am »
Hello,
I want to know, is there any LZ-String implementation in pascal/lazarus ?.
Just something like this : https://github.com/rufushuang/lz-string4java

Sorry for my bad english

Yours faithfully,
dkur

Handoko

  • Hero Member
  • *****
  • Posts: 4712
  • My goal: build my own game engine using Lazarus
Re: LZ-String compress decompress
« Reply #1 on: July 22, 2022, 10:03:50 am »
Hello dkur,
Welcome to the forum.

I inspected into the source code of ZBase.pas, the Lazarus/FPC component for handling compression. It does mention LZ77, see line #91 in the picture below:
« Last Edit: July 22, 2022, 10:08:21 am by Handoko »

dkur

  • Newbie
  • Posts: 3
Re: LZ-String compress decompress
« Reply #2 on: July 23, 2022, 08:14:02 am »
Hi, thanks for your reply.
I need LZ-String implementation for my laz coding. It seems that zbase not fit for my coding.
I need to decode json output from uricomponent method.

Thaddy

  • Hero Member
  • *****
  • Posts: 11943
Re: LZ-String compress decompress
« Reply #3 on: July 23, 2022, 09:20:45 am »
Which LZ do you need? LZO, LZ4, LZ77, LZ78, LZP, LZH,  LZ77, LZSS, LZMA, LZW and more? There are many flavors, but you simply state LZ.
Lempel-Ziff on its own is more of an academic excercise and hardly used on its own.
Lempel-Ziff-Hoffman is a practical implementation and so is e.g the Lempel-Ziff-Storer-Symanski.
The code you link to isn't too clear about what is implemented. Just that it can do lossless compress and decompress.
It misses any academic reference.
(I suspect you just need a deflate)
All these algorithms are rather simple to implement for an intermediate programmer, but without knowing the flavor I can not help you.
Maybe zlib will work and comes as standard package in the fpc distribution. It is also standards conformant.
It contains extensive documentation in the sourcecode (so you need the package sourcecode -: zlib.pas. It also works to decompress Python compressed sources and vice-versa, so that may be the right one.
« Last Edit: July 23, 2022, 09:59:56 am by Thaddy »
Black themes should be banned.

dkur

  • Newbie
  • Posts: 3
Re: LZ-String compress decompress
« Reply #4 on: July 23, 2022, 03:18:48 pm »
Hi, thanks for you reply
Sory for my respon before, not decoded, what i mean or need is LZ-String code in pascal to decompress json file, the json file before, was encrypted by aes & sha256. LZ-string, i think its implementation of lzw algorithm.

In the link i mentioned before, it was lz string write in java. In github also there was go, vb net, c# code for lz string but none in pascal.


Sory for my bad english.

 

TinyPortal © 2005-2018