I'm not sure of the exact scheme, but it's something like, where the ipv4 address is a.b.c.d the scramble is hex1.hex2.hex3.IP and the hex are created like
hex3 = md5(c.d secret)
hex2 = md5(b.c.d secret)
hex1 = md5(a.b.c.d secret)
The md5 is longer, and they only return 8 of the hex digits, i'm not sure which 8. Not sure if they would have updated to sha1, because of the need to perform this hash so frequently. Once you know the exact format for the input to the md5, you'd still need to know the secret, and it's not necessarily the same secret for each function.
md5 is a one-way hash, so it's not like encryption where you just decrypt it if you know the key. Also, because they hide 24 of the 32 hex digits, there are lots of secrets which would create those matching 8 hex digits.
Probably the best you're going to do is know that everyone who has the same hex3.IP string as you have is going to have the same a.b portion of their ipv4 matching.
I don't know how they scramble ipv6's.