William said:
Is there a "standard" algorithm for anti virus programs?
No - they all work differently. The underlying principles are similar
however.
How about a standard for the signature files?
There is no such thing either.
I'm impressed by how fast AVs are -- they can't be searching every
file for 1000 different strings, so there must
be some sort of trick involved.
They could if they wanted to. There are some multiple pattern matching
algorithms the speed of which does not depend on the number of strings
they search for. (One of them is called Aho-Corasick for example. It's
pretty easy to understand in theory.) Or they could use hashing.
Then, they don't search the entire files, but only parts of it. And they
don't search for all viruses in all files. It wouldn't make sense to
search for Mydoom in the boot sector.
Actually, the reason why "they can't be searching every file for 1000
different string" is not speed, but detection reliability. Viruses
aren't detected with simple strings anymore, because some of them change
their appearance. To detect all possible variants of a complex virus one
would have to add thousands of different signatures, and that is still
an optimistic estimate!
An important feature of modern scanners is the emulator, i.e. scanners
execute programs (and thus the viruses that they contain) in a safe
environment in order for the virus to reveal information about itself
and decrypt itself if it's encrypted.
Then they can proceed with the identification of the virus using
checksumming or maybe even with search strings.
In fact modern anti-virus programs are quite complex, so from a purely
technical point of view we should forgive them if they happen to miss a
virus from time to time. ;-)