php8.5
Home/ Manual/ mcrypt / functions/ mcrypt_module_self_test

mcrypt_module_self_test

PHP function Edit on GitHub ✎

(PHP 4 >= 4.0.2, PHP 5, PHP 7 < 7.2.0, PECL mcrypt >= 1.0.0)

This function runs a self test on the specified module

Removed-7-2-0

Description

mcrypt_module_self_test(string $algorithm, [string $lib_dir]): bool

This function runs the self test on the algorithm specified.

Parameters

algorithm

Cipher

lib_dir

The optional lib_dir parameter can contain the location where the algorithm module is on the system.

Return Values

The function returns true if the self test succeeds, or false when it fails.

Examples

mcrypt_module_self_test() example

php
<?php
var_dump(mcrypt_module_self_test(MCRYPT_RIJNDAEL_128)) . "\n";
var_dump(mcrypt_module_self_test(MCRYPT_BOGUS_CYPHER));
?>

The above example will output:

output
bool(true)
bool(false)

Source: reference/mcrypt/functions/mcrypt-module-self-test.xml · from the official PHP manual (php/doc-en)