Source for own packer wanted

Just starting out? Need help? Post your questions and find answers here.
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Source for own packer wanted

Post by Ralf »

I used the packlib to test to pack some datas! Really impressive! Have someone coded an own small packer in purebasic? I would like to have a small own packer (esp for packing datas with vals between $00 and $31) and learn how does it works! I know there are sources for ZIP and Co. available but i dont really understand that much.

Can someone poste his example of packing/unpacking datas or a source in any other basic language?

Btw a packer is based only on math or is it still based on routines like Strings too?
User avatar
aszid
Enthusiast
Enthusiast
Posts: 162
Joined: Thu May 01, 2003 8:38 pm
Location: California, USA
Contact:

Post by aszid »

well... here's my packer i made, it's pretty basic, and it packs files, not data. (and it does so recursively)

anyhow, this might be a start for you, enjoy.
--Aszid--

Making crazy people sane, starting tomorrow.
Edwin Knoppert
Addict
Addict
Posts: 1073
Joined: Fri Apr 25, 2003 11:13 pm
Location: Netherlands
Contact:

Post by Edwin Knoppert »

I believe JCALG is free?

www.collakesoftware.com

I had an include for PowerBASIC somewhere..
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Check tips & tricks...

I've posted the full source code for a packer system and installer system writen in Purebasic, with a bit of changes you can create a packer program for applications...

:lol:
Pupil
Enthusiast
Enthusiast
Posts: 715
Joined: Fri Apr 25, 2003 3:56 pm

Post by Pupil »

Edwin Knoppert wrote:I believe JCALG is free?

www.collakesoftware.com

I had an include for PowerBASIC somewhere..
PureBasic uses the JCALG1 algorithm for the packer lib, no need to redo it ;)
But it might be an interesting read though..
User avatar
aszid
Enthusiast
Enthusiast
Posts: 162
Joined: Thu May 01, 2003 8:38 pm
Location: California, USA
Contact:

Post by aszid »

umm... just call me stupid... i forgot the link in my last post -_-

viewtopic.php?t=6042&highlight=packer

it's been one of those days *sigh*
--Aszid--

Making crazy people sane, starting tomorrow.
Ralf
Enthusiast
Enthusiast
Posts: 203
Joined: Fri May 30, 2003 1:29 pm
Location: Germany

Post by Ralf »

Mhhh... maybe there is a small mistake!? I know how to use the packer lib of PB to pack any data or files. I still want an pack algorhythm written in basic - no need of PB pack lib nor any DLL! I want to know, see and try to understand how does an good pack and unpack routine works.

I think the algo is only based on math operations or will there be any string operations too!? Any sources are welcome
User avatar
aszid
Enthusiast
Enthusiast
Posts: 162
Joined: Thu May 01, 2003 8:38 pm
Location: California, USA
Contact:

Post by aszid »

aaah i see....

well, i don't have any sources i can point you to, but i can give you a VERY simplistic rundown of how packers work. i could be wrong too... but this still might be the direction you wanted to head.

basically, what a packer does, is finds patterns. say if i have a file, and the pattern "ABCDE" shows up quite often, i can use something else to represent the "ABCDE". or say i have a file that only uses 16 of the ascii characters, i could easily cut the filesize in half by simply condensing every 2 bytes of data into a single byte.

it get's a bit clearer looking at it in the binary way.

each byte is eight 1's and/or 0's.
[edit - because my stupidity didn't end with my first post]
say i was using just the first 16 characters of the ascii table for this example.
[end of edit]

before packing:
00001010 - 00001111 - 00001011 - 00000101

after packing:
10101111 - 10110101

hope this has made some sense to you... like i said, it's VERY simplistic compared to the kinds of compression that are possible.

[edit - just to add some more ideas]

on the other hand, if you changed the base you were using to represent ascii characters (normally 8 bits) to something greater, say you made your packer use binary directly, if you made your "bytes" to be 9 bits then you could essentially pack 2x the info as a normal byte into 1.125 bytes. or you could go higher, making 10 bits contain what would normally take 24 bits.

[end of edit]
--Aszid--

Making crazy people sane, starting tomorrow.
User avatar
blueb
Addict
Addict
Posts: 1118
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Post by blueb »

Ralf,

If you're looking for sample compression programs, please look at:
http://www.pbcrypto.com/pbcrypto.php and go down to the COMPRESSION ALGORITHMS section.

They were written in PowerBASIC but can easily be modified for Pure.

--blueb
Post Reply