★ wanayoo — archive 1999 http://www.php.net/manual/function.mdecrypt-generic.phpNouvelle recherche | Portail wanayoo

PHP Home Page

Manual Table of Contents
Up to mcrypt
Quick Reference
Japanese version of this page
mcrypt
* mcrypt_get_cipher_name
* mcrypt_get_block_size
* mcrypt_get_key_size
* mcrypt_create_iv
* mcrypt_cbc
* mcrypt_cfb
* mcrypt_ecb
* mcrypt_ofb
* mcrypt_list_algorithms
* mcrypt_list_modes
* mcrypt_get_iv_size
* mcrypt_encrypt
* mcrypt_decrypt
* mcrypt_module_open
* mcrypt_generic_init
* mcrypt_generic
* mdecrypt_generic
* mcrypt_generic_end
* mcrypt_enc_self_test
* mcrypt_enc_is_block_algorithm_mode
* mcrypt_enc_is_block_algorithm
* mcrypt_enc_is_block_mode
* mcrypt_enc_get_block_size
* mcrypt_enc_get_key_size
* mcrypt_enc_get_supported_key_sizes
* mcrypt_enc_get_iv_size
* mcrypt_enc_get_algorithms_name
* mcrypt_enc_get_modes_name
* mcrypt_module_self_test
* mcrypt_module_is_block_algorithm_mode
* mcrypt_module_is_block_algorithm
* mcrypt_module_is_block_mode
* mcrypt_module_get_algo_block_size
* mcrypt_module_get_algo_key_size
* mcrypt_module_get_algo_supported_key_sizes
Manual: mdecrypt_generic
View the source code for this pageSearch the site



Previous page
 mcrypt_generic
 Updated
Fri, 11 Aug 2000
mcrypt_generic_end 
Next page


mdecrypt_generic

(unknown)

mdecrypt_generic -- This function decrypts data

Description

string mdecrypt_generic (resource td, string data)

This function decrypts data. Note that the length of the returned string can in fact be longer then the unencrypted string, due to the padding of the data.

Example 1. Mdecrypt_generic() Example


<?php
$iv_size = mcrypt_enc_get_iv_size ($td));
$iv = @mcrypt_create_iv ($iv_size, MCRYPT_RAND);

if (@mcrypt_generic_init ($td, $key, $iv) != -1)
{
    $c_t = mcrypt_generic ($td, $plain_text);
    @mcrypt_generic_init ($td, $key, $iv);
    $p_t = mdecrypt_generic ($td, $c_t);
}
if (strncmp ($p_t, $plain_text, strlen($plain_text)) == 0)
    echo "ok";
else
    echo "error";
?>
      
The above example shows how to check if the data before the encryption is the same as the data after the decryption.


 About Notes


Previous page
 mcrypt_generic
 Updated
Fri, 11 Aug 2000
mcrypt_generic_end 
Next page





Who's responsible for this?
Top of this page

Site
Hosting:



Located in
United States
Elements of this website are subject to copyright.
Questions about installing or using PHP should be directed to one of the mailing lists.
Only questions about the website should be directed to webmaster@php.net.