Introduction to Zend\CryptΒΆ

Zend\Crypt provides support of some cryptographic tools. The available features are:

  • encrypt-then-authenticate using symmetric ciphers (the authentication step is provided using HMAC);
  • encrypt/decrypt using symmetric and public key algorithm (e.g. RSA algorithm);
  • generate digital sign using public key algorithm (e.g. RSA algorithm);
  • key exchange using the Diffie-Hellman method;
  • Key derivation function (e.g. using PBKDF2 algorithm);
  • Secure password hash (e.g. using Bcrypt algorithm);
  • generate Hash values;
  • generate HMAC values;

The main scope of this component is to offer an easy and secure way to protect and authenticate sensitive data in PHP. Because the use of cryptography is not so easy we recommend to use the Zend\Crypt component only if you have a minimum background on this topic. For an introduction to cryptography we suggest the following references:



Most of the ideas behind the Zend\Crypt component have been inspired by the PHP-CryptLib project of Anthony Ferrara. PHP-CryptLib is an all-inclusive pure PHP cryptographic library for all cryptographic needs. It is meant to be easy to install and use, yet extensible and powerful enough for even the most experienced developer.

Previous topic

Console prompts

Next topic

Encrypt/decrypt using block ciphers

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to Introduction to Zend\Crypt on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.