| From: | Joe Conway <mail(at)joeconway(dot)com> | 
|---|---|
| To: | Francisco Reyes <lists(at)natserv(dot)com> | 
| Cc: | pgsql General List <pgsql-general(at)postgresql(dot)org> | 
| Subject: | Re: bytea to int conversion? | 
| Date: | 2002-07-09 16:24:04 | 
| Message-ID: | 3D2B0E24.1050204@joeconway.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
Francisco Reyes wrote:
> Is there a way to convert bytea to int?
> I just got the libcrypto library installed in order to get CRC32 support.
> After getting some help I got it working, but now I am trying to figure
> out how to compare the value returned by the function, bytea, with PHP's
> CRC32 (a number).
> 
> I did not see any function to do such conversion.
> I also wonder what are some letters that appear to the left or right of
> the backlashed numbers.
> 
>>From reading the documentation it seems bytea are numbers on base 8.
> For example I tried  select digest('a','crc32');
>     digest
> ---------------
>  k\233\223\031
> (1 row)
> 
> I converted the 233, 223 and 031 to hex
> 9b 93 19
> 
> and then to decimal
> 10195737
> 
> But this differs from the result from PHP's CRC32 computation for the
> same, 'ab', string -1635563411
> 
See stripcslashes() and pack() in the PHP documentation.
HTH,
Joe
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Momjian | 2002-07-09 16:28:44 | Re: I am being interviewed by OReilly | 
| Previous Message | Oliver Elphick | 2002-07-09 15:49:47 | Re: (A) native Windows port |