[This question has nothing to do with login credentials, or the user/player inputting any kind of pass-phrase, etc; thank you and keep reading.]
First off, my question has already sort of been asked, here and here. My question is different than either of these though, because I am not connecting through the internet to get data or concerned with any type of "logging in". To put this as simply as I can, I am making a game, and my games resources are all encrypted into a proprietary format, which takes a single password to decrypt the data. I have to hide that password in the source code. I can't think of any other way than to keep the password within the application itself. Encrypting the password within another file would still take a password, and that just starts this endless circle of where to hide that password, and so on.
This got me wondering, how do modern games handle their resource decryption passwords? Think of games like Call of Duty, Elder Scrolls, Grand Theft Auto, etc. They encrypt their data, right? So that means that they need a password/salt/etc to decrypt it. Such a password would also need to be within the executable, too. So where do they hide it? How do they obfuscate it?
I considered one option, which seems like it would actually be pretty good. Basically, I would construct a method which would run through some bizzare gauntlet of mathmatical computations, construct a string, and return the data to serve as the password. Someone could just rip the method out of the code and then launch it in their own private app, but at least it wouldnt be so blatant as:
public const string ResourceDecryptionPassword = "MY_AWESOME_DECRYPTION_PASSWORD";
Also, I considered just keeping the password as a large hardcoded array of bytes, which I could convert back to a string during application start.
Can anyone suggest any other solutions to this problem?
Also, and I forgot to mention: the source code of my game will be obufsicated. This is a no brainer, so it will already make it difficult to visually walk through the code. I just need a good solution for how to hide the password for my encrypted resources.