Urgent PHP help for manipulating binary files

Discussion in 'PHP' started by MakeADifference, Aug 6, 2009.

  1. #1
    I need to implement the following logic on a binary file.


    open file pImage FOR binary update
    REPEAT WITH tOffset = 0 to 7
    local tData
    read from file pImage at (tOffset * 512 + 1) FOR 16 characters
    put it into tData
    REPEAT WITH tByte = 1 to 16
    put numtochar(chartonum(char tByte of tData) bitXor chartonum(char tByte of RANDOM_STRING)) into char tByte of tData
    END REPEAT
    write tData to file pImage at (tOffset * 512)
    END REPEAT
    close file pImage



    Basically you need to open the file, manipulate the file based on the above logic and save it.

    I am confused at this line:

    put numtochar(chartonum(char tByte of tData) bitXor chartonum(char tByte of RANDOM_STRING)) into char tByte of tData

    Please advice.
     
    MakeADifference, Aug 6, 2009 IP
  2. oop

    oop Peon

    Messages:
    35
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Im not the best with binary but did some work on it before conserning PHP+Binary and i had a few binary tools on the system one of witch was this one below

    http://www.phpclasses.org/browse/package/2454.html
    Code (markup):
    cant think of anymore as i aint got that application no more, hope it helps
     
    oop, Aug 7, 2009 IP