Jump to content

append binary data


 Share

Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...