Yes, sorry, meant it the other way around:

Delphi does Bankers rounding (round to even number). PHP does rounding up to
next integer if the fractional part is 0.5 or more.

Sorry for confusion.
Phil.
----- Original Message ----- 
From: "Marshall, Paul" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]>
Sent: Tuesday, June 01, 2004 2:05 PM
Subject: RE: [DUG] Encryption


> What you have described for PHP is Banker's Rounding - and Delphi does
> it too.
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On Behalf Of Phil Middlemiss
> Sent: Tuesday,June,01,2004 8:21 a.m.
> To: NZ Borland Developers Group - Delphi List
> Subject: Re: [DUG] Encryption
>
> Also be aware that some mathematical routines work differently in php
> than
> Delphi - for example rounding numbers using Delphi is done according to
> "Bankers Rounding" rules (what we are used to), whereas in php rounding
> a
> number half way between two integers (eg 1.5, 2.5 etc) will round to the
> even number (1.5 becomes 2, as does 2.5).
>
> May pay to just check simple parts of the encryption routine to confirm
> predicted output.
>
> Cheers,
> Phil.
>
> ----- Original Message ----- 
> From: "Corey Murtagh" <[EMAIL PROTECTED]>
> To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]>
> Sent: Monday, May 31, 2004 4:35 PM
> Subject: Re: [DUG] Encryption
>
>
> > Wayne Roser wrote:
> >
> > > Hi
> > > I have a friend who wants to encript a string in php and decrypt
> using
> > > delphi.
> > > Apparently it didn't work so he tried encripting "Hello world" (of
> course)
> > > in php and delphi he gets different result strings using the "same"
> > > encryption algorithm.
> > > Any clues?
> >
> > Yep... his algorithm or key is probably different on both :>
> >
> > If he's using a PRNG to generate keys or encode data, have him test
> the
> > output of the PRNG to make sure both version generate the same
> numbers.
> >   I ran foul of that with some bad assumptions between ECMAScript and
> > C++ (floating point precision).
> >
> > So... check key/key-stream, then check the implementation of the
> > algorithm to make sure the PHP and Delphi versions are identical (not
> > just 'close enough').  Run some more test strings through and examine
> > the outputs for similarities, and for tell-tales like one output being
> > smaller than the other.
> >
> > -- 
> > Corey Murtagh
> > The Electric Monk
> > "Quidquid latine dictum sit, altum viditur!"
>
>
>
> =======================================================================
> Attention: The information contained in this message and/or attachments
> from AgResearch Limited is intended only for the persons or entities
> to which it is addressed and may contain confidential and/or privileged
> material. Any review, retransmission, dissemination or other use of, or
> taking of any action in reliance upon, this information by persons or
> entities other than the intended recipients is prohibited by AgResearch
> Limited. If you have received this message in error, please notify the
> sender immediately.
> =======================================================================
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to