I have a string literal in my program, I'm trying to create an amateur checksum to ensure the string literal was not replaced in the portable executable.
To do this, I create a hash of the string literal, and store it as a integer literal in the program. Now I have two literals, one for the string and one for the hash.
In my code, I implement the checksum by using a function that hashes the string literal in the same way, I create a new runtime hash and check that hash against the hash literal.
The problem is of course, with compiler optimizations it may pre-compute the runtime hash, and then im checking a hash literal against a hash literal and the checksum will always return true.
So I'm looking for a trick to make the compiler think the string literal is a dynamic string that could be anything, so that it will not do the constant folding optimization on the runtime hash and my code will work correctly.