I want to make sure that the dynamic link libraries used by my application can't be replaced with other libraries of the same name, in order to inject malicious code. Therefore, I thought about creating a fingerprint of the DLLs before releasing new application versions.
The application would then validate the fingerprint before the DLL is loaded. Would this provide good protection in the above scenario?
Regarding the hash function: I'm not sure whether or not to use MD5, or one of SHA algorithms. I know MD5 isn't safe to collision attacks, but it is safe against preimage attacks.
Against which attacks should I protect the libraries (using fingerprints)?