MCrypt is a Perl extension for MCrypt Crypto library. MCrypt is a file encryption method. It uses secure techniques to exchange data. MCrypt is used for some web apps such as Magento, the shopping cart software, php framework like Laravel. MCrypt is a replacement for the popular Unix crypt command. Crypt is a file encryption tool. MCrypt uses several algorithms such as: AES, DES, TripleDES, Blowfish (default), 3-WAY, SAFER-SK64, SAFER-SK128, TWOFISH, TEA, RC2, GOST, LOKI, SERPENT, MARS, CAST, and RIJNDAEL in CBC, OFB, CFB, and ECB cipher modes. It can be used to encrypt and decrypt using these ciphers. MCrypt allows developers to use a wide range of encryption functions. It allows users to encrypt files or data streams without using cryptographers. MCrypt allows user to decide which algorithm you consider the best for encrypting data. It also has compatibility mode with Unix crypt (1) and with solaris des (1). Unix Crypt (1) is a file encryption program in Unix boxes.
MCrypt is a simple crypting program. A new file is created with .nc extension and mode 0600 after encryption or decryption. mcrypt_cfb(), mcrypt_cbc(), mcrypt_ecb(), and mcrypt_ofb() are the four important mcrypt commands. It can operate in MCRYPT_ENCRYPT and MCRYPT_DECRYPT modes respectively.
Mcrypt_cbc() encrypts or decrypts the data with cipher and key in CBC cipher mode and it returns the resulting string. It encrypts or decrypt data based on the mode.
Mcrypt_ecb() encrypts or decrypts the data with cipher and key in ECB cipher mode and it returns the resulting string. It encrypts or decrypt data based on the mode.
Mcrypt_ofb() encrypts or decrypts the data with cipher and key in OFB cipher mode and it returns the resulting string. It encrypts or decrypt data based on the mode.
Mcrypt_cfb() encrypts or decrypts the data with cipher and key in CFB cipher mode and it returns the resulting string. It encrypts or decrypt data based on the mode.
MCrypt can operate in CBC, OFB, CFB, and ECB block cipher modes.
ECB stands for Electronic Code Book. It is suitable for random data, such as encrypting other keys. The disadvantages of ECB have a negative effect because of the short and random data.
CBC stands for Cipher Block Chaining. It is especially suitable for encrypting files where the security is increased over ECB significantly.
CFB stands for Cipher Feedback. It is the best mode for encrypting byte streams where single bytes must be encrypted.
OFB stands for Output feedback, in 8bit. It is comparable to CFB. It can be used in applications where error propagation cannot be tolerated. OFB is insecure because it operates in 8bit mode so it is not recommended to use it.
Libmcrypt is a library of code that implements all the algorithms and modes used in MCrypt. It contains the actual encryption functions and provide an easy method for use. Libmcrypt does not have any random number generators, hashes, hmac implementation, key exchange, and public key encryption. It implements an interface to access block and stream encryption algorithms and to assist in the development of MCrypt by providing a uniform interface to access several different encryption algorithms. BLOWFISH, TWOFISH, DES, TripleDES, 3-WAY, SAFER-sk64, SAFER-sk128, SAFER+, LOKI97, GOST, RC2, RC6, MARS, IDEA, RIJNDAEL-128 (AES), RIJNDAEL-192, RIJNDAEL-256, SERPENT, CAST-128, CAST-256, ARCFOUR, and WAKE are the algorithms supported by Libmcrypt. Block algorithms can be used in: CBC, ECB, CFB and OFB.
1) # yum install epel-release
2) # yum install php-mcrypt
3) Enable mcrypt in /etc/php.ini file
# vi /etc/php.ini
4) Restart apache
# service httpd restart
Examples of some MCrypt commands
To see available encryption algorithms
# mcrypt –list
Encrypt the given file with new name filename.nc using blowfish algorithm
# mcrypt –a blowfish filename
Decrypt the file filename.txt.nc to filename.txt.
# mcrypt –d filename.txt.nc
Display the help for the whole mcrypt command with all its options
# mcrypt –help
Encrypt the data file
# ncrypt the data.txt file
Features of MCrypt
1) Provides Algorithm Vulnerability
2) Provides Compression: By compressing your data before encryption provides efficiency, faster encryption, and safety of your data.
3) Error Recovery: CFB mode used in MCrypt will recover the removed files from the file or stream in ECB, CBC and OFB modes. MCrypt also uses a 32 bit CRC to check for errors in the encrypted files.
4) Extra security: For the paranoid it ensures that no important data (keys etc.) are written to disk, as swap when it executed with super user privileges.
If you need any further assistance please contact our support department.
You can skip to the end and leave a response. Pinging is currently not allowed.