On 2007-08-29 19:15:37 -0400, Guy Hulbert wrote: > On Thu, 2007-08-30 at 00:49 +0200, Michael Holzt wrote: > > > or even > > > 10 + 1 + 16 + 1 + 39 + 1 + 5 + 1 + 39 + 1 + 5 = 119 characters > > > > Better encode it binary. E.g. for IPv4: > > And better get the number of bits correct. An IP address is a 32 bit > integer, not 15 characters.
You've snipped the context. JT was calling the
Qpsmtpd::Connection::local_ip method which does indeed return a string
of up to 15 characters, not an integer of 32 bits.
> Although perl converts scalars on-demand, it correctly preserves
> integer values.
JT was using string concatenation, so that doesn't help.
Yes, it would be possible to call inet_aton on the return value of
local_ip, do the equivalent on local_port, then concatenate them, and
send them through base64, thus encoding 48 bits of information in 8
characters. But JT didn't do this, so his scheme needs 21 characters to
encode the same information.
hp
--
_ | Peter J. Holzer | I know I'd be respectful of a pirate
|_|_) | Sysadmin WSR | with an emu on his shoulder.
| | | [EMAIL PROTECTED] |
__/ | http://www.hjp.at/ | -- Sam in "Freefall"
signature.asc
Description: Digital signature
