I'm making a personal security tool in C++ and was curious how I would go about encrypting files in C++. If anyone has a method that would be great, and more specifically I was interested in 3DES encryption.


closed as off-topic by yyyyyyy, fkraiem, AleksanderRas, Ella Rose Jun 30 at 17:26

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

  • "Programming questions are off-topic even if you are writing or debugging cryptographic code. Unless your question is specifically about how the cryptographic algorithm, protocol or side-channel (mitigation) works, you should look into asking on Stack Overflow instead." – yyyyyyy, fkraiem, AleksanderRas
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ Welcome to crypto.stackexchange - This is a programming question, and programming questions are off-topic here even if they are about using cryptography. Programming questions belong on stackoverflow. I can migrate this to stackoverflow for you. $\endgroup$ – Ella Rose Jun 30 at 17:25

3DES is an old and slow cipher. In 2019, it is probably a bad idea to build new applications based on this algorithm.

Choosing a cipher, is not the only thing that matter in cryptography. You need a mode of operation like CBC or GCM to specify how to combine encryption function on long messages. If you don't use AEAD modes, you probably need a MAC construction to protect ciphertexts from malleability.

Choosing all theses things in a secure way is difficult. That's why, your best option is to use a library that provide a secure API for encryption. Libsodium is a mature example of such library and the crypto_secretbox_* functions are probably what you need. They are based on XSalsa20+Poly1305 construction.

  • $\begingroup$ That's awesome, thanks for the info, I'll check it out. $\endgroup$ – Sean9981 Jun 30 at 16:52

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