PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Encryption » Crypt_Blowfish » Bug #8649

Encrypted strings are invaild

Details

Submitted2006-09-07 09:25 UTC
Fromsven at teamspeak-systems dot de
StatusBogus
PackageCrypt_Blowfish
PHP Version5.1.4
OSWindows XP
Roadmaps(Not assigned)

Comments

[2006-09-07 09:25 UTC] sven at teamspeak-systems dot de

Description:
------------
Hi there!

Before I begin, here's some information about my system:

PHP Versions: 5.1.1 (ZDE Debugger), 5.1.4
PHP Configure Command: cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
Server API: Apache 2.0 Handler
PEAR package: 1.4.11

I've just tried to create a small script with the Crypt_Blowfish package. The problem is, that there will always appear various NUL characters at the end of the decrypted string. I've replaced these characters with "[NUL]" in the result below.

Is there a known bug or am I making a mistake? Thanks in advance!

Regards
Sven

Test script:
---------------
<?php

header('Content-Type: text/plain');

require_once('./includes/Blowfish.php');

$crypt = new Crypt_Blowfish('testing');

$string = 'Hello World!';
$encrypted = $crypt->encrypt($string);
$decrypted = $crypt->decrypt($encrypted);

echo 'Original: ' . $string . ' -> Length: ' . strlen($string) . '\n';
echo 'Encrypted: ' . $encrypted . ' -> Length: ' . strlen($encrypted) . '\n';
echo 'Decrypted: ' . $decrypted . ' -> Length: ' . strlen($decrypted) . '\n';

?>

Expected result:
----------------
X-Powered-By: PHP/5.1.1
Content-Type: text/plain

Original: Hello World! -> Length: 12
Encrypted: 2E°{[NUL]3[NUL]nÀ<‡´[NUL]*n$ -> Length: 16
Decrypted: Hello World! -> Length: 12

Actual result:
--------------
X-Powered-By: PHP/5.1.1
Content-Type: text/plain

Original: Hello World! -> Length: 12
Encrypted: 2E°{[NUL]3[NUL]nÀ<‡´[NUL]*n$ -> Length: 16
Decrypted: Hello World![NUL][NUL][NUL][NUL] -> Length: 16