php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18166 integer != autocasted double
Submitted: 2002-07-04 13:05 UTC Modified: 2002-10-26 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: php at triplefusion dot net Assigned:
Status: No Feedback Package: Math related
PHP Version: 4.2.1 OS: Windows NT 5
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: php at triplefusion dot net
New email:
PHP Version: OS:

 

 [2002-07-04 13:05 UTC] php at triplefusion dot net
I've ran into a bit of trouble trying to implement Blowfish in PHP- I've successfully ported a C implementation, and implemented a test-vector test in both languages.

The output (needs a fixed-width font) might speak for itself:

C Blowfish test:
Result    Key              L indata L result R indata R result  L indata L result R indata R result
Success   0000000000000000 000000ff 00000000 00000000 00000000  00000000 4ef99745 4ef99745 6198dd78
Success   ffffffffffffffff 00000000 ffffffff ffffffff ffffffff  ffffffff 51866fd5 51866fd5 b85ecb8a
Success   3000000000000000 00000011 10000000 10000000 00000001  00000001 7d856f9a 7d856f9a 613063f2
Success   1111111111111111 00000023 11111111 11111111 11111111  11111111 2466dd87 2466dd87 8b963c9d
Success   0123456789abcdef 00000011 11111111 11111111 11111111  11111111 61f9c380 61f9c380 2281b096
Success   1111111111111111 00000000 01234567 01234567 89abcdef  89abcdef 7d0cc630 7d0cc630 afda1ec7
Success   0000000000000000 000000dc 00000000 00000000 00000000  00000000 4ef99745 4ef99745 6198dd78
Success   fedcba9876543210 000000a1 01234567 01234567 89abcdef  89abcdef 0aceab0f 0aceab0f c6a0a28d
Success   7ca110454a1a6e57 00000031 01a1d6d0 01a1d6d0 39776742  39776742 59c68245 59c68245 eb05282b
Success   0131d9619dc1376e 000000a1 5cd54ca8 5cd54ca8 3def57da  3def57da b1b8cc0b b1b8cc0b 250f09a0
Success   07a1133e4a0b2686 00000049 0248d438 0248d438 06f67172  06f67172 1730e577 1730e577 8bea1da4
Success   3849674c2602319e 000000b9 51454b58 51454b58 2ddf440a  2ddf440a a25e7856 a25e7856 cf2651eb
Success   04b915ba43feb5b6 00000013 42fd4430 42fd4430 59577fa2  59577fa2 353882b1 353882b1 09ce8f1a
Success   0113b970fd34f2ce 00000070 059b5e08 059b5e08 51cf143a  51cf143a 48f4d088 48f4d088 4c379918
Success   0170f175468fb5e6 00000029 0756d8e0 0756d8e0 774761d2  774761d2 432193b7 432193b7 8951fc98
Success   43297fad38e373fe 000000a7 762514b8 762514b8 29bf486a  29bf486a 13f04154 13f04154 d69d1ae5
Success   07a7137045da2a16 00000068 3bdd1190 3bdd1190 49372802  49372802 2eedda93 2eedda93 ffd39c79
Success   04689104c2fd3b2f 000000d0 26955f68 26955f68 35af609a  35af609a d887e039 d887e039 3c2da6e3
Success   37d06bb516cb7546 00000008 164d5e40 164d5e40 4f275232  4f275232 5f99d04f 5f99d04f 5b163969
Success   1f08260d1ac2465e 00000040 6b056e18 6b056e18 759f5cca  759f5cca 4a057a3b 4a057a3b 24d3977b
Success   584023641aba6176 00000058 004bd6ef 004bd6ef 09176062  09176062 452031c1 452031c1 e4fada8e
Success   025816164629b007 00000079 480d3900 480d3900 6ee762f2  6ee762f2 7555ae39 7555ae39 f59b87bd
Success   49793ebc79b3258f 000000b0 437540c8 437540c8 698f3cfa  698f3cfa 53c55f9c 53c55f9c b49fc019
Success   4fb05e1515ab73a7 000000e9 072d43a0 072d43a0 77075292  77075292 7a8e7bfa 7a8e7bfa 937e89a3
Success   49e95d6d4ca229bf 00000083 02fe5577 02fe5577 8117f12a  8117f12a cf9c5d7a cf9c5d7a 4986adb5
Success   018310dc409b26d6 00000058 1d9d5c50 1d9d5c50 18f728c2  18f728c2 d1abb290 d1abb290 658bc778
Success   1c587f1c13924fef 00000001 30553228 30553228 6d6f295a  6d6f295a 55cb3774 55cb3774 d13ef201
Success   0101010101010101 0000001f 01234567 01234567 89abcdef  89abcdef fa34ec48 fa34ec48 47b268b2
Success   1f1f1f1f0e0e0e0e 000000fe 01234567 01234567 89abcdef  89abcdef a7907951 a7907951 08ea3cae
Success   e0fee0fef1fef1fe 00000000 01234567 01234567 89abcdef  89abcdef c39e072d c39e072d 9fac631d
Success   0000000000000000 000000ff ffffffff ffffffff ffffffff  ffffffff 014933e0 014933e0 cdaff6e4
Success   ffffffffffffffff 00000023 00000000 00000000 00000000  00000000 f21e9a77 f21e9a77 b71c49bc
Success   0123456789abcdef 000000dc 00000000 00000000 00000000  00000000 24594688 24594688 5754369a
Success   fedcba9876543210 00000000 ffffffff ffffffff ffffffff  ffffffff 6b5c5a9c 6b5c5a9c 5d9e0a5a
34/34 tests succeeded.

PHP Blowfish test:
Result    Key              L indata    L result    R indata    R result     L indata    L result    R indata    R result
Success   0000000000000000 00000000(i) 00000000(i) 00000000(i) 00000000(i)  4ef99745(i) 4ef99745(i) 6198dd78(i) 6198dd78(i)
Failure 1 ffffffffffffffff ffffffff(d) ffffffff(i) ffffffff(d) ffffffff(i)  51866fd5(i) 51866fd5(i) b85ecb8a(d) b85ecb8a(i)
Success   3000000000000000 10000000(i) 10000000(i) 00000001(i) 00000001(i)  7d856f9a(i) 7d856f9a(i) 613063f2(i) 613063f2(i)
Failure 4 1111111111111111 11111111(i) 11111111(i) 11111111(i) 11111111(i)  2466dd87(i) 2466dd87(i) 8b963c9d(d) 8b963c9d(i)
Success   0123456789abcdef 11111111(i) 11111111(i) 11111111(i) 11111111(i)  61f9c380(i) 61f9c380(i) 2281b096(i) 2281b096(i)
Failure 2 1111111111111111 01234567(i) 01234567(i) 89abcdef(d) 89abcdef(i)  7d0cc630(i) 7d0cc630(i) afda1ec7(d) afda1ec7(i)
Success   0000000000000000 00000000(i) 00000000(i) 00000000(i) 00000000(i)  4ef99745(i) 4ef99745(i) 6198dd78(i) 6198dd78(i)
Failure 2 fedcba9876543210 01234567(i) 01234567(i) 89abcdef(d) 89abcdef(i)  0aceab0f(i) 0aceab0f(i) c6a0a28d(d) c6a0a28d(i)
Failure 4 7ca110454a1a6e57 01a1d6d0(i) 01a1d6d0(i) 39776742(i) 39776742(i)  59c68245(i) 59c68245(i) eb05282b(d) eb05282b(i)
Failure 3 0131d9619dc1376e 5cd54ca8(i) 5cd54ca8(i) 3def57da(i) 3def57da(i)  b1b8cc0b(d) b1b8cc0b(i) 250f09a0(i) 250f09a0(i)
Failure 4 07a1133e4a0b2686 0248d438(i) 0248d438(i) 06f67172(i) 06f67172(i)  1730e577(i) 1730e577(i) 8bea1da4(d) 8bea1da4(i)
Failure 3 3849674c2602319e 51454b58(i) 51454b58(i) 2ddf440a(i) 2ddf440a(i)  a25e7856(d) a25e7856(i) cf2651eb(d) cf2651eb(i)
Success   04b915ba43feb5b6 42fd4430(i) 42fd4430(i) 59577fa2(i) 59577fa2(i)  353882b1(i) 353882b1(i) 09ce8f1a(i) 09ce8f1a(i)
Success   0113b970fd34f2ce 059b5e08(i) 059b5e08(i) 51cf143a(i) 51cf143a(i)  48f4d088(i) 48f4d088(i) 4c379918(i) 4c379918(i)
Failure 4 0170f175468fb5e6 0756d8e0(i) 0756d8e0(i) 774761d2(i) 774761d2(i)  432193b7(i) 432193b7(i) 8951fc98(d) 8951fc98(i)
Failure 4 43297fad38e373fe 762514b8(i) 762514b8(i) 29bf486a(i) 29bf486a(i)  13f04154(i) 13f04154(i) d69d1ae5(d) d69d1ae5(i)
Failure 4 07a7137045da2a16 3bdd1190(i) 3bdd1190(i) 49372802(i) 49372802(i)  2eedda93(i) 2eedda93(i) ffd39c79(d) ffd39c79(i)
Failure 3 04689104c2fd3b2f 26955f68(i) 26955f68(i) 35af609a(i) 35af609a(i)  d887e039(d) d887e039(i) 3c2da6e3(i) 3c2da6e3(i)
Success   37d06bb516cb7546 164d5e40(i) 164d5e40(i) 4f275232(i) 4f275232(i)  5f99d04f(i) 5f99d04f(i) 5b163969(i) 5b163969(i)
Success   1f08260d1ac2465e 6b056e18(i) 6b056e18(i) 759f5cca(i) 759f5cca(i)  4a057a3b(i) 4a057a3b(i) 24d3977b(i) 24d3977b(i)
Failure 4 584023641aba6176 004bd6ef(i) 004bd6ef(i) 09176062(i) 09176062(i)  452031c1(i) 452031c1(i) e4fada8e(d) e4fada8e(i)
Failure 4 025816164629b007 480d3900(i) 480d3900(i) 6ee762f2(i) 6ee762f2(i)  7555ae39(i) 7555ae39(i) f59b87bd(d) f59b87bd(i)
Failure 4 49793ebc79b3258f 437540c8(i) 437540c8(i) 698f3cfa(i) 698f3cfa(i)  53c55f9c(i) 53c55f9c(i) b49fc019(d) b49fc019(i)
Failure 4 4fb05e1515ab73a7 072d43a0(i) 072d43a0(i) 77075292(i) 77075292(i)  7a8e7bfa(i) 7a8e7bfa(i) 937e89a3(d) 937e89a3(i)
Failure 2 49e95d6d4ca229bf 02fe5577(i) 02fe5577(i) 8117f12a(d) 8117f12a(i)  cf9c5d7a(d) cf9c5d7a(i) 4986adb5(i) 4986adb5(i)
Failure 3 018310dc409b26d6 1d9d5c50(i) 1d9d5c50(i) 18f728c2(i) 18f728c2(i)  d1abb290(d) d1abb290(i) 658bc778(i) 658bc778(i)
Failure 4 1c587f1c13924fef 30553228(i) 30553228(i) 6d6f295a(i) 6d6f295a(i)  55cb3774(i) 55cb3774(i) d13ef201(d) d13ef201(i)
Failure 2 0101010101010101 01234567(i) 01234567(i) 89abcdef(d) 89abcdef(i)  fa34ec48(d) fa34ec48(i) 47b268b2(i) 47b268b2(i)
Failure 2 1f1f1f1f0e0e0e0e 01234567(i) 01234567(i) 89abcdef(d) 89abcdef(i)  a7907951(d) a7907951(i) 08ea3cae(i) 08ea3cae(i)
Failure 2 e0fee0fef1fef1fe 01234567(i) 01234567(i) 89abcdef(d) 89abcdef(i)  c39e072d(d) c39e072d(i) 9fac631d(d) 9fac631d(i)
Failure 1 0000000000000000 ffffffff(d) ffffffff(i) ffffffff(d) ffffffff(i)  014933e0(i) 014933e0(i) cdaff6e4(d) cdaff6e4(i)
Failure 3 ffffffffffffffff 00000000(i) 00000000(i) 00000000(i) 00000000(i)  f21e9a77(d) f21e9a77(i) b71c49bc(d) b71c49bc(i)
Success   0123456789abcdef 00000000(i) 00000000(i) 00000000(i) 00000000(i)  24594688(i) 24594688(i) 5754369a(i) 5754369a(i)
Failure 1 fedcba9876543210 ffffffff(d) ffffffff(i) ffffffff(d) ffffffff(i)  6b5c5a9c(i) 6b5c5a9c(i) 5d9e0a5a(i) 5d9e0a5a(i)
9/34 tests succeeded.

Failure number refers to the first L or R column pair that failed - they should be identical.
In the PHP test, ( ) refers to the first letter of it's gettype() result- integer or double.

Looking at this it seems PHP doesn't seem to allow that int == float, but allows to print them, and then they turn out equal.

Also, you will note the PHP and C values are very different, although the code is nearly exactly the same - I can't figure out what causes this, but since the results seem to be OK, it does not seem to matter :|

I'm not going to post my huge (20 kb) script here, but I'll send it if anyone needs to see it.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-10 11:55 UTC] iliaa@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-10-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC