Jump to content

Help on handling of binary data !


 Share

Recommended Posts

this is my code:

Func encrypt($file, $key)
    
    Dim $res = Binary(0);
    $t = 0
    ;$arr = StringSplit($text, "")
    $keyarr = StringSplit($key, "")
    Dim $filedata  = Binary(0);
    Dim $erg  = Binary(0);
    $filedata = FileRead(FileOpen ( $file, 16 ))
    $filelen = BinaryLen( $filedata )
    $keytstart2 = Ceiling($keyarr[0]/2)
    $keytbend2 = Floor($keyarr[0]/2)
    $tlen2 = ($keyarr[0]-$keytstart2)+1;
    ConsoleWrite("Filesize: " & $filelen & @CRLF)
    for $i = 0 to $filelen Step 4
        For $im = 0 to $keytbend2-1
            $val = Asc($keyarr[$im+1])+$im+$i
            if $tlen2 > $val Then
                $spos = Mod($tlen2, $val)
            Else
                $spos = Mod($val, $tlen2)
            EndIf
            
            $keyarr = ArraySwap($keyarr, $im+1, $keytstart2+$spos)
        Next
        $kstr = ""
        For $im = 1 to $keyarr[0]
            $kstr &= $keyarr[$im]
        Next
        
        $keybinary = StringToBinary($kstr);
        $keylen = BinaryLen($keybinary);
        
        ;$c_keychar = $keyarr[Mod($i-1,$keyarr[0])+1];
        $c_keybyte = Mod($i, $keylen)
        ;ConsoleWrite("Current Keybyte: " & $c_keybyte & "(Mod(" & $i & ", " & $keylen & "))" &@CRLF)
        $erg = BitXOR(BinaryMid($keybinary, $c_keybyte, 4),BinaryMid($filedata, $i, 4))
        if $i > 4 Then
            $c_keybytePrior = Mod($i-4, $keylen)
            
            $erg = BitXOR(BinaryMid($keybinary, $c_keybytePrior, 4), $erg)
        EndIf
        ConsoleWrite("Binary Length of block: " & BinaryLen($erg) & @CRLF)
        $res &= $erg
        ConsoleWrite("Binary Length of $res " & BinaryLen($res) & @CRLF)
    Next
    FileClose($file)
    return $res
EndFunc

HOW IN THE HELL can i get this in my console?

...

Binary Length of block: 4

Binary Length of $res 13953

Binary Length of block: 4

Binary Length of $res 13955

Binary Length of block: 4

Binary Length of $res 13957

Binary Length of block: 4

Binary Length of $res 13959

Binary Length of block: 4

Binary Length of $res 13961

Binary Length of block: 4

Binary Length of $res 13963

Binary Length of block: 4

Binary Length of $res 6982

Binary Length of block: 4

Binary Length of $res 6983

Binary Length of block: 4

Binary Length of $res 6984

Binary Length of block: 4

Binary Length of $res 6985

Binary Length of block: 4

Binary Length of $res 6986

Binary Length of block: 4

Binary Length of $res 6987

Binary Length of block: 4

Binary Length of $res 13979

Binary Length of block: 4

Binary Length of $res 13981

Binary Length of block: 4

Binary Length of $res 13983

Binary Length of block: 4

Binary Length of $res 13985

Binary Length of block: 4

Binary Length of $res 13987

Binary Length of block: 4

Binary Length of $res 13989

Binary Length of block: 4

Binary Length of $res 6995

Binary Length of block: 4

Binary Length of $res 6996

Binary Length of block: 4

Binary Length of $res 6997

Binary Length of block: 4

Binary Length of $res 6998

Binary Length of block: 4

Binary Length of $res 6999

Binary Length of block: 4

Binary Length of $res 7000

Binary Length of block: 4

Binary Length of $res 7001

Binary Length of block: 4

Binary Length of $res 7002

Binary Length of block: 4

Binary Length of $res 7003

Binary Length of block: 4

Binary Length of $res 7004

Binary Length of block: 4

Binary Length of $res 7005

Binary Length of block: 4

Binary Length of $res 14015

Binary Length of block: 4

Binary Length of $res 14017

Binary Length of block: 4

Binary Length of $res 14019

Binary Length of block: 4

Binary Length of $res 14021

Binary Length of block: 4

Binary Length of $res 7011

Binary Length of block: 4

Binary Length of $res 7012

Binary Length of block: 4

Binary Length of $res 7013

Binary Length of block: 4

Binary Length of $res 7014

Binary Length of block: 4

Binary Length of $res 7015

Binary Length of block: 4

Binary Length of $res 7016

Binary Length of block: 4

Binary Length of $res 7017

Binary Length of block: 4

Binary Length of $res 14037

Binary Length of block: 4

Binary Length of $res 14039

Binary Length of block: 4

Binary Length of $res 7020

Binary Length of block: 4

Binary Length of $res 7021

Binary Length of block: 4

Binary Length of $res 14047

Binary Length of block: 4

Binary Length of $res 14049

Binary Length of block: 4

Binary Length of $res 14051

Binary Length of block: 4

Binary Length of $res 14053

Binary Length of block: 4

Binary Length of $res 14055

Binary Length of block: 4

Binary Length of $res 14057

Binary Length of block: 4

Binary Length of $res 14059

Binary Length of block: 4

Binary Length of $res 7030

Binary Length of block: 4

Binary Length of $res 7031

Binary Length of block: 4

Binary Length of $res 7032

Binary Length of block: 4

Binary Length of $res 7033

Binary Length of block: 4

Binary Length of $res 7034

Binary Length of block: 4

Binary Length of $res 7035

Binary Length of block: 4

Binary Length of $res 7036

Binary Length of block: 4

Binary Length of $res 7037

Binary Length of block: 4

Binary Length of $res 7038

Binary Length of block: 4

Binary Length of $res 7039

Binary Length of block: 4

Binary Length of $res 7040

Binary Length of block: 4

Binary Length of $res 14085

Binary Length of block: 4

Binary Length of $res 14087

Binary Length of block: 4

Binary Length of $res 14089

Binary Length of block: 4

Binary Length of $res 14091

Binary Length of block: 4

Binary Length of $res 7046

Binary Length of block: 4

Binary Length of $res 7047

Binary Length of block: 4

Binary Length of $res 14099

Binary Length of block: 4

Binary Length of $res 14101

Binary Length of block: 4

Binary Length of $res 14103

Binary Length of block: 4

Binary Length of $res 14105

Binary Length of block: 4

Binary Length of $res 14107

Binary Length of block: 4

Binary Length of $res 14109

Binary Length of block: 4

Binary Length of $res 7055

Binary Length of block: 4

Binary Length of $res 7056

Binary Length of block: 4

Binary Length of $res 7057

Binary Length of block: 4

Binary Length of $res 7058

Binary Length of block: 4

Binary Length of $res 14121

Binary Length of block: 4

Binary Length of $res 14123

Binary Length of block: 4

Binary Length of $res 14125

Binary Length of block: 4

Binary Length of $res 14127

Binary Length of block: 4

Binary Length of $res 14129

Binary Length of block: 4

Binary Length of $res 14131

Binary Length of block: 4

Binary Length of $res 14133

Binary Length of block: 4

Binary Length of $res 14135

Binary Length of block: 4

Binary Length of $res 14137

Binary Length of block: 4

Binary Length of $res 7069

Binary Length of block: 4

Binary Length of $res 7070

Binary Length of block: 4

Binary Length of $res 14145

Binary Length of block: 4

Binary Length of $res 14147

Binary Length of block: 4

Binary Length of $res 14149

Binary Length of block: 4

Binary Length of $res 14151

Binary Length of block: 4

Binary Length of $res 14153

Binary Length of block: 4

Binary Length of $res 14155

Binary Length of block: 4

Binary Length of $res 14157

Binary Length of block: 4

Binary Length of $res 7079

Binary Length of block: 4

Binary Length of $res 7080

Binary Length of block: 4

Binary Length of $res 7081

Binary Length of block: 4

Binary Length of $res 7082

Binary Length of block: 4

Binary Length of $res 7083

Binary Length of block: 4

Binary Length of $res 7084

Binary Length of block: 4

Binary Length of $res 7085

Binary Length of block: 4

Binary Length of $res 7086

Binary Length of block: 4

Binary Length of $res 7087

Binary Length of block: 4

Binary Length of $res 7088

Binary Length of block: 4

Binary Length of $res 7089

Binary Length of block: 4

Binary Length of $res 14183

Binary Length of block: 4

Binary Length of $res 14185

Binary Length of block: 4

Binary Length of $res 14187

Binary Length of block: 4

Binary Length of $res 14189

Binary Length of block: 4

Binary Length of $res 7095

Binary Length of block: 4

Binary Length of $res 7096

Binary Length of block: 4

Binary Length of $res 7097

Binary Length of block: 4

Binary Length of $res 7098

Binary Length of block: 4

Binary Length of $res 7099

Binary Length of block: 4

Binary Length of $res 7100

Binary Length of block: 4

Binary Length of $res 7101

Binary Length of block: 4

Binary Length of $res 14205

Binary Length of block: 4

Binary Length of $res 14207

Binary Length of block: 4

Binary Length of $res 7104

Binary Length of block: 4

Binary Length of $res 7105

Binary Length of block: 4

Binary Length of $res 14215

Binary Length of block: 4

Binary Length of $res 14217

Binary Length of block: 4

Binary Length of $res 7109

..

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...