Bug #52989 [Opn->Bgs]: the mcrypt_encrypt and mcrypt_decrypt functions are not accurate working.
Edit report at http://bugs.php.net/bug.php?id=52989&edit=1
ID: 52989
Updated by: derick@php.net
Reported by: info at wtovn dot com
Summary: the mcrypt_encrypt and mcrypt_decrypt functions are
not accurate working.
-Status: Open
+Status: Bogus
Type: Bug
Package: *Encryption and hash functions
Operating System: WIN32
PHP Version: 5.3SVN-2010-10-05 (snap)
Block user comment: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Thanks for the explanation uramihsayibok; I did not know this.
Previous Comments:
------------------------------------------------------------------------
[2010-10-13 04:01:36] uramihsayibok at gmail dot com
Not a bug. It's due to the nature of DES.
The least significant bit of each byte in the key is NOT USED, and the
only difference between the characters '0' and '1' is that least
significant bit. You can see the same behavior swapping 'B' and 'C',
'P'
and 'Q', and 'x' and 'y' (to give some examples). Generically, any
even-numbered ASCII character can be swapped with its n+1 neighbor, and
vice versa.
Separately: ECB mode does not use IVs so $iv is pointless.
------------------------------------------------------------------------
[2010-10-05 06:24:39] info at wtovn dot com
Description:
------------
the mcrypt_encrypt and mcrypt_decrypt functions are not accurate
working.
please see script below.
Test script:
---------------
$data = "Cá»ng hòa xã há»i chá»§ nghÄ©a viá»t nam, Äá»c
láºp
tự do hạnh phúc";
$iv_size = mcrypt_get_iv_size(MCRYPT_3DES, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = "01";
$crypttext = mcrypt_encrypt(MCRYPT_3DES, $key, $data,
MCRYPT_MODE_ECB, $iv);
$key = "10";
$decrypt = mcrypt_decrypt (MCRYPT_3DES, $key , $crypttext ,
MCRYPT_MODE_ECB, $iv) ;
then result are :
$data = $decrypt ????
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52989&edit=1
Thread (3 messages)