Jump to content
Sign in to follow this  
pixartist

append binary data

Recommended Posts

pixartist

can i use & to append binary data to binary data (eg. 1 byte) ?

if not, how to do it then`?

Share this post


Link to post
Share on other sites
BrettF
pixartist

Can't see why not... ;)

Maybe post your code,

Cheers,

Brett

ok the appending works now.. i made a little mistake there. still:

Case $encrypt
            
            $f = FileOpenDialog("Choose File",@ScriptDir, "Any (*.*)", 1)
            if $f then
                $enc = encrypt($f,  GUICtrlRead($key))
                $s = FileSaveDialog( "Choose a name.", @ScriptDir, "any (*.*)", 18)
                if $s Then
                    $fi= FileOpen ( $s, BitOR(16, 1) )
                    If $fi = -1 Then
                        MsgBox(0, "Error", "Unable to open file.")
                        Exit
                    EndIf

                    ConsoleWrite($enc)
                    FileWrite($fi, Binary($enc))
                    FileClose($fi)
                EndIf
                
            EndIf

will actually write a STRING of NUMBERS instead of binary data to a file, wtf?

Share this post


Link to post
Share on other sites
pixartist

ok the appending works now.. i made a little mistake there. still:

Case $encrypt
            
            $f = FileOpenDialog("Choose File",@ScriptDir, "Any (*.*)", 1)
            if $f then
                $enc = encrypt($f,  GUICtrlRead($key))
                $s = FileSaveDialog( "Choose a name.", @ScriptDir, "any (*.*)", 18)
                if $s Then
                    $fi= FileOpen ( $s, BitOR(16, 1) )
                    If $fi = -1 Then
                        MsgBox(0, "Error", "Unable to open file.")
                        Exit
                    EndIf

                    ConsoleWrite($enc)
                    FileWrite($fi, Binary($enc))
                    FileClose($fi)
                EndIf
                
            EndIf

will actually write a STRING of NUMBERS instead of binary data to a file, wtf?

omg now i see

BitXOR only works on 32 bit integers -.-

how can i xor with bytes ?

edit: ok, perhaps like this?

$erg = BitXOR(Number(BinaryMid($keybinary, $c_keybyte, 4)),Number(BinaryMid($filedata, $i, 4)))... i guess not, because the Number function will take the binary as a string?

also, how do i convert a 32bit integer into binary again?

Edited by pixartist

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.