Decode IPs

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Monster
Registered User
Posts: 30
Joined: Fri Nov 30, 2001 12:23 pm

Decode IPs

Post by Monster » Tue Apr 09, 2002 5:34 am

I saw that IPs are encrypted and I saw how to decrypt them.

On a seperate script I want to decrypt the IPs so I can display them.

How would I do this?

Jarf
Registered User
Posts: 1202
Joined: Mon Sep 17, 2001 1:50 am
Location: Albuquerque, NM
Contact:

Post by Jarf » Tue Apr 09, 2002 6:32 am

IP's aren't encrypted, they are in a different number base. You'll find them as Hexadecimal without the .'s

There is a function someplace (either in the phpBB code or in the database server) which will do it for you.

You can do it by hand too. Each portion of an IP address is two hex digits. You can use the windows calculator or some other calculator (or if you are really good in hex, your head) to do it two hex digits at a time.

Monster
Registered User
Posts: 30
Joined: Fri Nov 30, 2001 12:23 pm

Post by Monster » Tue Apr 09, 2002 6:33 am

What is a simple PHP script to do it?

I was reading through the function and was unable to understand it.

z00om
Registered User
Posts: 23
Joined: Wed Nov 28, 2001 7:04 am
Contact:

Post by z00om » Tue Apr 09, 2002 6:37 am

eh....
try this:

http://www.php.net/manual-lookup.php?pattern=hex

something in there might help

Jarf
Registered User
Posts: 1202
Joined: Mon Sep 17, 2001 1:50 am
Location: Albuquerque, NM
Contact:

Post by Jarf » Tue Apr 09, 2002 6:42 am

Let me give you an example of how it works functionally.

let's use the ip address: 192.168.1.101

192 in hex is C0
168 in hex is A2
1 in hex is 1 (which also equals 01)
101 in hex is 65

put them together to get C0A20165

do the opposite to get the decimal values

Locked

Return to “2.0.x Support Forum”