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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC