php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3104 Extra character padding in encrypt/decrypt
Submitted: 2000-01-05 03:32 UTC Modified: 2000-01-08 06:51 UTC
From: gmerrall at email dot com Assigned:
Status: Closed Package: mcrypt related
PHP Version: 4.0 Latest CVS (05/01/2000) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: gmerrall at email dot com
New email:
PHP Version: OS:

 

 [2000-01-05 03:32 UTC] gmerrall at email dot com
Using libmcrypt-2.2.4, PHP 4 (Latest CVS) as Apache 1.3.9 module.
Extra chars are being added either at the encryption or decryption stage using mcrypt_ecb().
This script is an adaption of the script in the PHP manual.

<?php
$key = "this_is_my_key";
$input = "123456789";
printf ("Input Text: %s Count:%s\n", $input, strlen($input));
$encrypted_data = mcrypt_ecb(MCRYPT_TripleDES, $key, $input, MCRYPT_ENCRYPT);
$decrypted_data = mcrypt_ecb(MCRYPT_TripleDES, $key, $encrypted_data, MCRYPT_DECRYPT);
printf ("Decrypt Text: %s Count:%s", $decrypted_data, strlen($decrypted_data));
?>

Output:
Input Text: 123456789 Count:9
Decrypt Text: 123456789        Count:16     



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-01-08 06:51 UTC] sas at cvs dot php dot net
Input buffers will always be NUL-padded to match the blocksize of the respective algorithm.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue May 13 09:01:27 2025 UTC