From: dietrich at pegestorf dot de
Operating system: linux
PHP version: 4.3.4
PHP Bug Type: *General Issues
Bug description: sha1 generates a wrong hash
Description:
------------
I try to generate a sha1 hash with sha1()
$hash = sha1("test");
$hash is calculated wrong to: "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3"
I have a file /tmp/data with the word "test" in it (no carriage return at
the end)
$hash = sha1_file("/tmp/data");
$hash is calculated right to:
"4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"
let's go tho the command line and enter:
echo test | openssl dgst -sha1
this generate also "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"
same than
openssl dgst -sha1 /tmp/data
If I generate the hash over "test\n" with the sha1() the hash is
calculated right to "4e1243bd22c66e76c2ba9eddc1f91394e57f9f83"
--
Edit bug report at http://bugs.php.net/?id=26485&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26485&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26485&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=26485&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=26485&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=26485&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=26485&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=26485&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=26485&r=support
Expected behavior: http://bugs.php.net/fix.php?id=26485&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=26485&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=26485&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=26485&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26485&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=26485&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=26485&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=26485&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26485&r=float