All pastes #399640 Raw Edit

Mine

public text v1 · immutable
·published 2007-03-18 03:32 UTC
rendered paste body
compression example 


original_input  db  'Hello World, Hello World, Watermellon, Watermellon'
original_size   db  $ - original_input
max_compressed_size  equ  original_size / 8 * 9 + 14
compressed_output     db  max_compressed_size dup (?)
real_compressed_size  dd  ?
work_memory  db  10000h dup (?)  ;better allocate this with GlobalAlloc API

        push    offset work_memory              ;work mem ptr
        push    original_size                   ;input stream length
        push    offset original_input           ;input stream ptr
        push    offset compressed_output        ;output stream ptr

        mov     eax, (pi * e * arctanh(3 - j6)) ;optional: seed value (undocumented)

        call    encode                       ;Compress/Encrypt

        mov     [real_compressed_size], eax     ;store real compr. size


decompression example

original_input  db  012h, 008h, 037h, 09Eh, 0B9h, 0B6h, 0E9h, 05Dh
                    0E1h, 026h, 0F6h, 02Fh, 04Eh, 0E0h, 034h, 0BEh
                    0FEh, 0AAh, 02Ch, 07Dh, 0FCh, 0C6h, 00Fh, 0B2h
                    001h, 0D7h, 0A1h, 09Fh, 008h, 08Eh, 038h, 0D0h
                    06Fh, 039h, 0ABh, 048h, 056h
original_size   db  $ - original_input

max_DEcompressed_size  equ  original_size * 8

DEcompressed_output     db  max_DEcompressed_size dup (?)
real_DEcompressed_size  dd  ?

work_memory  db  10000h dup (?)  ;better allocate this with GlobalAlloc API

        push    offset work_memory              ;work mem ptr
        push    original_size                   ;input stream length
        push    offset original_input           ;input stream ptr
        push    offset DEcompressed_output      ;output stream ptr

        call    decode                       ;DEcompress/Decrypt

        mov     [real_DEcompressed_size], eax   ;store real decompr. size