Introducing Patina

July 16, 2013 — Leave a comment

Patina is a tool for finding occurrences of byte data patterns in one file within the data of another.

For instance, let’s say you have two files. The first file contains this:


And the second file contains:


Then a match is found for the values 12345, since the second file contains this sequence.

OK, so let’s consider another scenario. The first file contains:


And the second file contains:


Notice the missing “5” in the second file. So obviously, a match will not be found for the full sequence of “12345”. So what will Patina do? Well, it will find a match for “1234”.

Patina starts with the longest possible sequence from the first file, and looks for it in the second file. So when no match is found for “12345”, the length to look for and the next sequence to check for is “1234”, then “2345”, then “123”, “234”, “345”, etc.

However, since Patina has already found a match for “1234”, it will not also find a match for “123” or “234”. The purpose is to get the longest possible matches and ignore any smaller matches within the found match.

Any matches that are found will just be output to the screen, in a format looking like this:

Data at position 0 (16 bytes) found in 2 place(s).

Of course it’s pretty useless to just get the output to the screen, but I’ll get around to dumping it as XML or JSON eventually.

The source code is on GitHub:

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.