Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Searching in binary files

by zentara (Archbishop)
on Dec 15, 2005 at 12:32 UTC ( [id://516935]=note: print w/replies, xml ) Need Help??


in reply to Searching in binary files

How about a "sniffing dog" approach(or fingerprints?). Break your search string into small fragments, but long enough to be fairly unique. Then search for those fragments in a small sliding chunks of the big file. If a fragment is found, check to see if the adjacent fragments are there. If the fragment is found near the beginning or end of the sliding chunk, load in the appropriate adjacent chunk and retest.

I'm not really a human, but I play one on earth. flash japh

Replies are listed 'Best First'.
Re^2: Searching in binary files
by BrowserUk (Patriarch) on Dec 15, 2005 at 12:47 UTC

    Sorry zentra, I don't quite follow. What's the advantage in searching for several smaller bits in the buffer over searching for one bigger bit?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      The advantage is that the regex you are running over the sliding binary chunks will be smaller, and (I think) therefore faster. So I figured it would be more efficient on big files. If it's a really big file, most chunks won't match, so why test a regex string of length 1000, when a test on length 250 will give a quick "sniff", indicating whether you should dig deeper at that general area.

      But as always, I defer to your greater experience and wisdom. :-)


      I'm not really a human, but I play one on earth. flash japh
        But as always, I defer to your greater experience and wisdom. :-)

        All I've got in abundance is age!


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://516935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (7)
As of 2024-04-16 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found