PHP mcrypt_decrypt() – Decrypt Ciphertext with Given Parameters

The PHP mcrypt_decrypt() function decrypts data using a specified cipher, key, mode, and optional initialization vector, returning the plaintext string or FALSE on failure, with detailed parameter descriptions and usage notes.

Laravel Tech Community
Laravel Tech Community
Laravel Tech Community
PHP mcrypt_decrypt() – Decrypt Ciphertext with Given Parameters

The PHP function mcrypt_decrypt() decrypts data using a specified cipher, key, mode, and optional initialization vector, returning the plaintext string or FALSE on failure.

Parameters

cipher – One of the MCRYPT_ciphername constants or a string name of the algorithm.

key – The encryption key; if its length is not supported by the chosen algorithm, a warning is issued and FALSE is returned.

data – The ciphertext to be decrypted; if its size is not a multiple of the block size, it is padded with '\0' to fill the final block.

mode – One of the MCRYPT_MODE_modename constants or a string such as "ecb", "cbc", "cfb", "ofb", "nofb", or "stream".

iv – Initialization vector required for CBC, CFB, OFB modes and some stream algorithms; missing or incorrectly sized IV triggers a warning and FALSE.

Return value – The decrypted data as a string, or FALSE on failure.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

encryptioninformation securitydecryptionmcrypt
Laravel Tech Community
Written by

Laravel Tech Community

Specializing in Laravel development, we continuously publish fresh content and grow alongside the elegant, stable Laravel framework.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.