Aw man, I wish I would have seen this last month. Maybe this stuff will be interesting for anyone else that wants to learn more about cryptography, or you if you have some extra time. :) So one thing I've learned about cryptography is to never roll your own crypto libraries. Cryptography's security is rather binary: it's either perfectly implemented and secure, or imperfectly implemented and insecure. One crack in the armor will take down the whole thing. And apparently cryptography implementation is non-trivial. Many complex considerations must be taken into account-- things that people like you and me don't know enough to not do. Things like how intermediate computations are stored in memory, and even things like information gleaned from how much time it takes for the algorithm to execute. So use widely-used crypto libraries that have been audited by security expert peers. On a related note, be very suspicious of any company that creates their own cryptographic algorithm instead of using an existing one. Like Telegram. A really good resource is the Matasano Crypto Challenges, which will teach you a ridiculous amount about cryptography through breaking faulty implementations of it. Another cool thing is this comic which teaches how AES works, and is surprisingly detailed and accurate.