help me to solve this . how to compare virus signature with file to detect virus in java? whether file content or file signature is compared for virus scanning?

If you want to do that, you could use Knuth-Morris-Pratt algorithm. Instead of comparing ASCII, do binary comparison. It takes O(n) time for each file (where n is the file size).

thank you ..is there any way to compare with out using alorithem...?

why you say java is not suitable for doing antivirus?

because it isn't. you'll need to have certain access to the OS, which, for the concept of platform independency, Java can't have.

sure, you'll be able to write software connecting to parts written in other languages, but this 'll make your application OS dependent, meaning you would have to re-write huge partsof the entire application. (and, this doesn't even guarantee it'll work)

It depends on what kind of anti-virus. If you are just scanning files for suspicious content on demand, then Java is perfectly suitable. If, on the other hand, you want a useful anti-virus that automatically scans all downloaded files, and monitors the system for suspicious behaviours, then Stuktuske said it all.

hi gud mor...thanks for your suggestion,
now i am trying to do in c,i have a doubt please clarify this ..
i have a virus signature for example"xxxxxxxxxxxx" .i have to scan a file for example "file.docx".do i need to search the virus signature in the content of a file called file.docx or how can i search the signature in that file ..please tell me the logic then i can try to finish this

This article has been dead for over six months. Start a new discussion instead.