The normal solution to this issue is to put the keys in a separate config file that doesn't get commit to version control or shipped with the open source code dumps. People using your code should get their own API keys and put them in their own versions of teh config file. Yours should stay private and not get distributed.
Eventually, you generally switch to a system for taking someone's normal twitter (or API of your choice) login and generating the required keys automatically form that via oath, etc. Then users of you app just have to provide their login info when they start t the first time, similar to but simpler than adding their own API keys to a config file.
Even if you could magically protect your key while also shipping it with your app, that would be a bad idea. That key is tied to your twitter identity, and thus anyone using your app would have their API activity logged to your account. That is bad. Users should be using their own API keys and.or twitter login, not yours. The correct solution is to use OAuth or to for easier to get their own API keys.