RE: [PHP] Hex2Bin??

2002-04-30 Thread John Holmes

This one will actually remove money from your bank account if you pass
the constant PHP_TAKE_MY_MONEY as the 10th argument.

---John Holmes...

> -Original Message-
> From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 30, 2002 8:06 PM
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Hex2Bin??
> 
> Computing-intensive, time-consuming and whatever else expensive
> functions do ;-)
> 
> Bogdan
> 
> Joshua E Minnie wrote:
> 
> >Expensive how?
> >
> >-josh
> >
> >"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote:
> >
> >>I'd recommend writing a wrapper around base_convert, naming it
hex2bin
> >>and using that instead. base_convert() is way too expensive for this
> >>purpose (you know that any hex figure is translated to exactly four
> >>bits, so you don't need any actual conversion - just replacement).
This
> >>is why I suggested the wrapper - you can change the code at any time
if
> >>you see it's too time-consuming...
> >>
> >
> >
> >
> 
> 
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Bogdan Stancescu

Computing-intensive, time-consuming and whatever else expensive 
functions do ;-)

Bogdan

Joshua E Minnie wrote:

>Expensive how?
>
>-josh
>
>"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote:
>
>>I'd recommend writing a wrapper around base_convert, naming it hex2bin
>>and using that instead. base_convert() is way too expensive for this
>>purpose (you know that any hex figure is translated to exactly four
>>bits, so you don't need any actual conversion - just replacement). This
>>is why I suggested the wrapper - you can change the code at any time if
>>you see it's too time-consuming...
>>
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Evan Nemerson

Computation time. CPU cycles.



On Tuesday 30 April 2002 13:56 pm, you wrote:
> Expensive how?
>
> -josh
>
> "Bogdan Stancescu" <[EMAIL PROTECTED]> wrote:
> > I'd recommend writing a wrapper around base_convert, naming it hex2bin
> > and using that instead. base_convert() is way too expensive for this
> > purpose (you know that any hex figure is translated to exactly four
> > bits, so you don't need any actual conversion - just replacement). This
> > is why I suggested the wrapper - you can change the code at any time if
> > you see it's too time-consuming...

-- 
Let us endeavor so to live that when we come to die even the undertaker will 
be sorry.

Samuel Clemens

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Evan Nemerson

Perhaps you could use something a little more KISS- like

rawurldecode(chunk_split ( $hexstring, 2 , "%"))

not sure if it would be faster than base_convert or not, but it 
wouldn't be too hard to find out.




On Tuesday 30 April 2002 11:50 am, you wrote:
> Although the first comment was not what I needed, I did find another
> built-in function that converts between any base, base_convert($number,
> $frombase, $tobase) worked wonderful for what I needed.
>
> Josh
>
> "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
> > On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> > > I know that there is a built-in function for bin2hex(), but does any
>
> body
>
> > > know have any code to do just the opposite, convert hex2bin?
> >
> > Check the first comment in the manual under bin2hex.
> >
> > miguel

-- 
Not life, but good life, is to be chiefly valued.

Socrates

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Joshua E Minnie

Expensive how?

-josh

"Bogdan Stancescu" <[EMAIL PROTECTED]> wrote:
> I'd recommend writing a wrapper around base_convert, naming it hex2bin
> and using that instead. base_convert() is way too expensive for this
> purpose (you know that any hex figure is translated to exactly four
> bits, so you don't need any actual conversion - just replacement). This
> is why I suggested the wrapper - you can change the code at any time if
> you see it's too time-consuming...



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Bogdan Stancescu

I'd recommend writing a wrapper around base_convert, naming it hex2bin 
and using that instead. base_convert() is way too expensive for this 
purpose (you know that any hex figure is translated to exactly four 
bits, so you don't need any actual conversion - just replacement). This 
is why I suggested the wrapper - you can change the code at any time if 
you see it's too time-consuming...

Bogdan

Joshua E Minnie wrote:

>Although the first comment was not what I needed, I did find another
>built-in function that converts between any base, base_convert($number,
>$frombase, $tobase) worked wonderful for what I needed.
>
>Josh
>
>"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>
>>On Tue, 30 Apr 2002, Joshua E Minnie wrote:
>>
>>>I know that there is a built-in function for bin2hex(), but does any
>>>
>body
>
>>>know have any code to do just the opposite, convert hex2bin?
>>>
>>Check the first comment in the manual under bin2hex.
>>
>>miguel
>>
>
>
>




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Joshua E Minnie

Although the first comment was not what I needed, I did find another
built-in function that converts between any base, base_convert($number,
$frombase, $tobase) worked wonderful for what I needed.

Josh

"Miguel Cruz" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> > I know that there is a built-in function for bin2hex(), but does any
body
> > know have any code to do just the opposite, convert hex2bin?
>
> Check the first comment in the manual under bin2hex.
>
> miguel
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Hex2Bin??

2002-04-30 Thread Miguel Cruz

On Tue, 30 Apr 2002, Joshua E Minnie wrote:
> I know that there is a built-in function for bin2hex(), but does any body
> know have any code to do just the opposite, convert hex2bin?

Check the first comment in the manual under bin2hex.

miguel


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php