I just installed 'mcrypt'. When I try to encrypt some file with DES using the command 'mcrypt -a des myfile', I am prompted for a passphrase with a maximum character count of 512.

> mcrypt -a des myfile
> Enter the passphrase (maximum of 512 characters)

How can DES support 512 characters or is there something wrong with the program? I like 'mcrypt' because it gives me the longest password characters but for DES?

Additionally, is the program secure enough?

I know that i been asking a lot but my final question will come after that one :)


I don't know about mcrypt itself, but I would not recommend using it. First off, I've never heard of it and don't know if it has been well-vetted. Second, DES does not have as much security as one would want, and should be avoided where possible.

Recommendation: I recommend you use GPG (GnuPG), PGP, or OpenPGP. These are well-vetted systems that have been carefully evaluated by cryptographers and are widely respected and trusted.

| improve this answer | |
  • i know that des not secure any more i like serpent or aes more, and i did use gpg but want to encrypt the file twice with two program and two cipher, any recommendation ? – rezx Jun 7 '12 at 18:32
  • IME, mcrypt is very reliable, flexible and compliant, the backend encryption lib crops up in all sorts of applications. But, agreed, that's pretty much not the issue if the data is only encrypted with DES. Note that none of mcrypt, GPG, openpgp are FIPS validated. – symcbean Jun 8 '12 at 8:37

The mcrypt home page does not give many details about what the program really does... Looking at the source code, I seed that it uses external libraries, including mhash, which appears to be involved in the passphrase-to-key transformation process.

The whole thing is underspecified (that is, not specified at all), which is reason enough not to use it. It is possible that mcrypt does things properly, in particular with regards to salting and iterating the computation (mhash advertises support for the string-to-key functions of OpenPGP, which offer decent security if used properly). But the lack of decent documentation makes it very difficult to assert anything in that respect.

At least, I can answer to your specific question: mcrypt accepts long passphrases because it uses some form of hashing to derive the passphrase into a symmetric key suitable for whichever encryption algorithm is used.

| improve this answer | |

Beyond OpenPGP or GPG, both of which have been mentioned and which are really the standard for encrypting documents, also bear in mind that OpenSSL can be used directly from the command line to encrypt/decrypt.

It's about as bare-bones as you can get, but it's at the same time it's extraordinarily flexible -- you can use any cipher and block-chaining mechanism that openssl supports, which is pretty much all of them.

openssl enc -e -pass file:passfile.txt -aes-256-cbc -in myfile.doc -out encrypted.bin

See the OpenSSL Documentation for more info. Or just Google it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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