How to work with cryptography

Four cryptography libraries

Library Description
mcrypt An encryption library that was included with PHP. However, this library was deprecated with PHP 7.1. With PHP 7.2, it is slated to be moved to PECL (PHP Extension Community Library), which is a repository of extensions for the PHP language.
Libsodium Defuse OpenSSL The current industry standard for cryptography. This library is available to PHP developers through PECL, but it is slated to be included with PHP 7.2.
Defuse An encryption library written in PHP. It requires PHP 5.4 or later, and it requires the OpenSSL extension to be enabled. This library is expected to remain stable and supported until at least January 1st , 2019.
OpenSSL An encryption library written in the C programming language. PHP includes a wrapper that allows you to use the OpenSSL library.

The URL for the Defuse cryptography library

https://github.com/defuse/php-encryption

One way to install the Defuse cryptography library

  1. Go to the URL shown above.
  2. Follow the instructions there to download the defuse-crypto.phar file that contains the library. If you’re serious about security, you should also follow the instructions there to verify the integrity of the defuse-crypto.phar file.
  3. Copy the defuse-crypto.phar file to a logical place on your file system. For example, you may want to put it in the xampp/php/lib directory.

Description

Back