Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

I am a beginning programmer interested in coding an application of my own to encrypt sensitive files of mine. For example: lists of passwords, bank accounts, Credit Card numbers etc.

I was wondering what would be the easiest encryption algorithms to learn from a purely theoretical point of view?

share|improve this question
    
Welcome to Crypto.SE. I assume you've already tried Wikipedia for ideas? The XOR cipher is probably the easiest but it's easy to break if not somehow turned into an OTP. The devil is in the details though. For securing sensitive information I'd suggest using GnuPG or TrueCrypt or any other freely available software (don't roll your own!). Anyway this question might be off-topic as it's a bit subjective and invites list answers. Good luck! –  rath Aug 8 '13 at 21:11
    
Okay, thanks for the info! I'll try the XOR cipher. –  Zagstrug Aug 8 '13 at 21:29
    
No I meant encrypting the files that contain the credit card info, and put that file on an external hard-drive rather than have an unencrypted file lying on my HD. I have heard of TrueCrypt, but wanted to challenge myself to replicate the same thing with more features for my own use/learning process. –  Zagstrug Aug 8 '13 at 22:22
2  
Definitely do not roll you own crypto software for you "own use". For learning is fine, but never use it for anything you want to actually be secure. The reason is that there are lots of intricacies when developing crypto software that if not understood could render your crypto solution completely insecure. TrueCrypt or GnuPG are good suggestions. –  mikeazo Aug 8 '13 at 22:49
1  
Doing this is a good learning exercise, but definitely don't use your software to store your (or worse, other people's) data. –  Gilles Aug 9 '13 at 14:36
add comment

closed as off-topic by rath, nightcracker, e-sushi, Gilles, Ilmari Karonen Aug 9 '13 at 18:13

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 2 down vote accepted

Concerning "As a new programmer...":

Probably you don't know this yet, but as a rule of thumb: Do not use your self-implemented crypto for anything unless you are really an expert in the field. This might seem counter-intuitive for the outside, but anything else has to be considered inseure.

The reason for this is that for most aspects of programming and computer science the average case is the most important one. It is not too important if there is a very unlikely flaw in a system, since it probably wont happen anyway. But in crypto the attacker will exploit this flaw to break the system on purpose. Therefore, not the average case is important, but the worst case. For example, you can find statements like "the probability of the attacker to guess right is no more than $\frac{1}{2^n}$" (worst case estimation).

The above statement is not entirely true, but it depends on the abstraction layer: If you utilize standard implementations of encyption, hash functions, key exchange, TLS etc... you can use those primitives in a high level protocol and most likely you are "secure".

But if you start writing your own crypto primitives, you will probably overlook something. Even worse, if you start using your primitive in a larger context, there is not only a small problem in a single function... you make the entire system insecure. Security is like a chain, and it breaks with the weakest link, not the "average strength".

Back on topic:

You can implement encryption schemes for practice or to learn something, but I advise heavily against using this.

For practice, this depends largely on your experience as a programmer. For the very start, you might want to consider using historical ciphers like Caesar, Vigenere in order to get comfortable with the principles (they are not secure, tho). If you want to have something more useful, you can implement a stream cipher (XOR cipher with some kind of random number generator). Some public key cryptosystems can be easily implemented, too. For example ElGamal encryption, plain RSA, DSA, etc. ... just stay away of elliptic curve crypto, unless you understand what those actually are.

For usage you might want to learn how to import and use standard crypto libraries, for example "Cryptlib", "Bouncy Castle", "OpenSSL", etc. E.G. this is a list of libraries.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.