jploettner
asked on
search large byte[] for the existiance of a smaller byte[] with C# and .NET 2.0
I'm reading a binary file into a byte array and need to search the bytes for patterns..
for file i read into:
byte[] fileBuffer = new byte[filesize];
and I'm trying to search for:
byte[] targetDLL = { 0x2E, 0x64, 0x6C, 0x6C, 0, 0 }; (and a few others)
A C#.NET 2.0 example of how to search the large file byte array for my smaller 'patterns' would be greatly appreciated!
for file i read into:
byte[] fileBuffer = new byte[filesize];
and I'm trying to search for:
byte[] targetDLL = { 0x2E, 0x64, 0x6C, 0x6C, 0, 0 }; (and a few others)
A C#.NET 2.0 example of how to search the large file byte array for my smaller 'patterns' would be greatly appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
if(current == targetDLL.Length) {
Console.WriteLine("Found pattern at index " + (i - targetDLL.Length).ToString
current = 0;
}