Èçäàòåëüñêèé äîì ÎÎÎ "Ãåéì Ëýíä"ÑÏÅÖÂÛÏÓÑÊ ÆÓÐÍÀËÀ ÕÀÊÅÐ #62, ßÍÂÀÐÜ 2006 ã.

Àëãîðèòìû ñæàòèÿ

GPcH (admin@dotfix.net)

Ñïåöâûïóñê: Õàêåð, íîìåð #062, ñòð. 062-062-5


www.ibsensoftware.com — ñàéò àâòîðîâ aplib. çäåñü ìîæíî ñêà×àòü áèáëèîòåêó èëè ñîðöû äåïàêåðà. òàêæå èìååòñß âîçìîæíîñòü êóïèòü aplib äëß êîììåð×åñêîé ýêñïëóàòàöèè, ïðàâäà, çà $29.

http://en.wikipedia.org — ïðîñòàß ýíöèêëîïåäèß, íåñìîòðß íà ýòî èìåííî â íåé î×åíü ïîäðîáíî ðàññìîòðåíû ìíîãèå àëãîðèòìû ñæàòèß, ðàññêàçàíî îá àâòîðàõ, äàíû àðõèïîëåçíûå ïåðåêðåñòíûå ññûëêè íà îïèñàíèå ðàçëè×íûõ òåõíîëîãèé, èñïîëüçóåìûõ ïðè ïîñòðîåíèè òîãî èëè èíîãî àëãîðèòìà.

êñòàòè, âîò ññûëêà íà îïèñàíèå àëãîðèòìîâ:

http://en.wikipedia.org/wiki/category:lossless_compression_algorithms.

ñàéòû ïîïóëßðíûõ àðõèâàòîðîâ:

www.powerarchiver.com — äîâîëüíî ìîùíûé ïàêåð. ñæèìàåò â ôîðìàòå 7zip. ïëàòíûé — ñòîèò îêîëî $20.

www.izarc.org — íàêîíåö-òî! åäèíñòâåííûé ïóòåâûé ïàêåð, êîòîðûé ìîæíî ïîëó×èòü àáñîëþòíî áåñïëàòíî. ïëþñ èìååòñß ïîääåðæêà òàêèõ ôîðìàòîâ, êàê 7-zip, a, ace, arc, arj, b64, bh, bin, bz2, bza, c2d, cab, cdi, cpio, deb, enc, gca, gz, gza, ha, img, iso, jar, lha, lib, lzh, mdf, mbf, mim, nrg, pak, pdi, pk3, rar, rpm, tar, taz, tbz, tgz, tz, uue, war, xxe, yz1, z, zip, zoo. âïå×àòëßåò?

Ðàñïàêîâùèê aplib íà Ñ: êàê âñå ïðîñòî

unsigned int aP_depack(unsigned char *source, unsigned char *destination)

{

unsigned int offs, len, R0, LWM;

int done; int i; aP_d_input = source;

aP_d_output = destination; LWM = 0;

aP_d_tagpos = 0; *aP_d_output = *aP_d_input;

aP_d_output++; aP_d_input++; done = 0;

while (!done)

{ if (aP_d_getbit()) { if (aP_d_getbit()) {

if (aP_d_getbit())

{

offs = 0;

for (i = 4; i; i--) offs = (offs << 1) + aP_d_getbit();

if (offs)

{

*aP_d_output = *(aP_d_output - offs);

aP_d_output++;

} else {

*aP_d_output = 0x00;

aP_d_output++;

}

LWM = 0;

} else {

offs = *aP_d_input;

aP_d_input++;

len = 2 + (offs & 0x0001);

offs >>= 1;

if (offs)

{

for (; len; len--)

{

*aP_d_output = *(aP_d_output - offs);

aP_d_output++;

}

} else done = 1;

R0 = offs;

LWM = 1;

}

} else {

offs = aP_d_getgamma();

if ((LWM == 0) && (offs == 2))

{

offs = R0;

len = aP_d_getgamma();

for (; len; len--)

{

*aP_d_output = *(aP_d_output - offs);

aP_d_output++;

}

} else {

if (LWM == 0) offs -= 3; else offs -= 2;

offs <<= 8;

offs += *aP_d_input;

aP_d_input++;

len = aP_d_getgamma();

if (offs >= 32000) len++;

if (offs >= 1280) len++;

if (offs < 128) len += 2;

for (; len; len--)

{

*aP_d_output = *(aP_d_output - offs);

aP_d_output++;

}

R0 = offs;

}

LWM = 1;

}

} else { *aP_d_output = *aP_d_input;

aP_d_output++; aP_d_input++;

LWM = 0; } }

return (aP_d_output - destination);

}

Îäíà èç ðåàëèçàöèé ìåòîäà Õàôôìàíà îò VVS Soft Group. Ïîëíûé èñõîäíèê — íà CD

procedure PakOneByte;

{ --- ñæàòèå è ïåðåñûëêà â âûõîäíîé áóôåð îäíîãî áàéòà --- }

Var Mask : word;

Tail : boolean;

begin

CRC:=CRC XOR InBuf[InCounter];

Mask:=CodeTable[InBuf[InCounter]]^.BiteChain SHR CounterBite;

OutWord:=OutWord OR Mask;

Íàçàä íà ñòð. 062-062-4  Ñîäåðæàíèå  Âïåðåä íà ñòð. 062-062-6