|
|
 |
RE: FN-FORUM: Anyone up for a little number puzzle?
date posted 18th January 2008 15:54
> -----Original Message-----
> Hi Guys,
>=20
> I have a small issue, I have third party piece of software that stores
> data in mySQL. It has an invoice table and an invoice_items table
>=20
> The tables are linked together using the invoice id field but the
> original programmer has encoded the invoice id from the invoice table
> and saved the encoded version in the invoice items table. The whole =
php
> application has been zend encoded so I can't check the code for the
> answer.
>=20
> What I'm trying to do is simply create a report using the data. But I
> can't match them up unless I can understand the encoding method.
>=20
> What I have at the moment is this when comparing the invoice id values
> with the encoded values
>=20
> 1 =3D %A4
> 2 =3D %A7
> 3 =3D %A6
> 4 =3D %A1
>=20
> However
>=20
> 10 =3D %A4%98
> 11 =3D %A4%99 NOT %A4%A4 as expected
> 12 =3D %A4%9A
>=20
> And
>=20
> 1024 =3D %A4%98%C4%C0 (Again not consistent)
>=20
So far in WAUK we have gotten this far with it, a php function that =
encodes the numbers 0 to 9 in the right way=20
function encode($i){
$base =3D 0xA; //init base
$i =3D $i ^ 0xF; //XOR with binary 1111
$i =3D $i ^ $base; //XOR with base
$i =3D $i ^ ($base |
 |
|