php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59407 getimageblob() on Imagick object from tiff file produces random md5 hashes
Submitted: 2010-09-08 19:28 UTC Modified: 2010-11-18 06:49 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: matvey at copters dot ru Assigned:
Status: Wont fix Package: imagick (PECL)
PHP Version: 5.2.8 OS: Linux Debian Lenny 64
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: matvey at copters dot ru
New email:
PHP Version: OS:

 

 [2010-09-08 19:28 UTC] matvey at copters dot ru
Description:
------------
getimageblob() on Imagick object from tiff file produces 
random md5 hashes:

rgp@cp ~/src $ cat s.php
<?php
$s = array(
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
);

foreach ($s as $t) {
  $ob = new Imagick("test.tif");
  $hash = hash('md5', $ob->getimageblob());
  echo "{$hash} \n";
}
?>
rgp@cp ~/src $ php -f s.php 
3a0eff2dc635064f91f9720e4f02fc25 
0e15adc163724345c26305df4cb2faed 
0e15adc163724345c26305df4cb2faed 
a6577644313c4fbd5014028c16a78e84 
dd391a6977cc7a6af56037959d607c90 
dd391a6977cc7a6af56037959d607c90 
83caff49e5d8abe704cf8c298770314f 
e85136bd4259b4b18e8f0bbc9867da9b 
36bdf4fc1806f83040b71a7214cc1d4c 
491f7bc84db9b83602f9d5ebc13f530a

and:

rgp@cp ~/src $ cat s.php
<?php
$s = array(
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
);

foreach ($s as $t) {
  $ob = new Imagick("test.tif");
  $hash = hash('md5', $ob->getimageblob());
  echo "{$hash} \n";
}
?>
rgp@cp ~/src $ php -f s.php 
3a0eff2dc635064f91f9720e4f02fc25 
0e15adc163724345c26305df4cb2faed 
0e15adc163724345c26305df4cb2faed 
a6577644313c4fbd5014028c16a78e84 
dd391a6977cc7a6af56037959d607c90 
dd391a6977cc7a6af56037959d607c90 
83caff49e5d8abe704cf8c298770314f 
e85136bd4259b4b18e8f0bbc9867da9b 
36bdf4fc1806f83040b71a7214cc1d4c 
491f7bc84db9b83602f9d5ebc13f530a

does not.




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-08 19:30 UTC] matvey at copters dot ru
sorry to repost: 
on the same file:

rgp@cp ~/src $ cat f.php 
<?php
$s = array(
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  10,
);

foreach ($s as $t) {
  $hash = hash_file('md5', "test.tif");
  echo "{$hash} \n";
}
?>
rgp@cp ~/src $ php -f f.php 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12 
be42c81505f2c9ef70994c60915a3f12
 [2010-11-18 06:49 UTC] mkoppanen@php.net
Hello,

I took your code and wrote two tif files to disk. It seems that the differences in the hashes come from timing / rounding issues:

1c1
< Image: b.tif
---
> Image: a.tif
79,81c79,81
<   Pixels per second: 10.24MB
<   User time: 0.120u
<   Elapsed time: 0:01.120
---
>   Pixels per second: 9.452MB
>   User time: 0.130u
>   Elapsed time: 0:01.129
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Feb 18 04:01:28 2025 UTC