Index of /IPBIG/

NameLast ModifiedSizeType
../ -  Directory
EXAMPLE.txt2026-Mar-27 11:14:314.3Ktext/plain; charset=utf-8
README.txt2026-Mar-27 12:41:384.9Ktext/plain; charset=utf-8
ipbig.c2026-Mar-27 11:14:303.9Ktext/x-csrc; charset=utf-8
ipbig.py2026-Mar-27 11:39:393.2Ktext/x-python; charset=utf-8
IPBIG ipv4 address to bignum converter

  _____  ___  ___ _       
  \_   \/ _ \/ __(_) __ _ 
   / /\/ /_)/__\// |/ _` |
/\/ /_/ ___/ \/  \ | (_| |
\____/\/   \_____/_|\__, |
                    |___/ 

### Compile ### 

gcc ipbig.c -o ipbig 

Usage:
  ./ipbig <IPv4>                  -> IPv4 -> small decimal (always works with ping)
  ./ipbig <big_number>            -> Big decimal -> IPv4 (lower 32 bits)
  ./ipbig -s <digits> <IPv4>      -> Large decimal (~<digits> digits) that works on UNIX/Linux

Examples:
  ./ipbig 192.168.11.1
  ./ipbig -s 100 192.168.11.1

user@unix % ./ipbig -s 100 192.168.11.1
3630913524808467469199941836062027292348045682210056851448434051826300000000000000000000003232238337
user@unix % ./ipbig -s 300 192.168.11.1
936786752379561480536554650651980973826054870595086322577294158129410112380576480252533782401409337546883936695043561557876938707511657792115525982563882799726265194099008931984928070445330261066613903131245836154552958878112867525418063452395518542246107006619046866500000000000000000000003232238337

You can then use the large decimal address like a regular IPv4 address 

eg:  ssh user@3630913524808467469199941836062027292348045682210056851448434051826300000000000000000000003232238337 
     ping 3630913524808467469199941836062027292348045682210056851448434051826300000000000000000000003232238337 
     ftp 3630913524808467469199941836062027292348045682210056851448434051826300000000000000000000003232238337 
     curl 3630913524808467469199941836062027292348045682210056851448434051826300000000000000000000003232238337 
     <whatever else ;)> 

Useful wen you want to obfuscate where you are connecting to ;) 

### Python ### 

python3 ipbig.py

- Same as the above 




How does this work ? 
====================

Mathematics behind converting an IPv4 address (like 192.168.11.1) to a single 
32-bit decimal number (like 3232238337).

------------------------------------------------------------------------------
1. Understanding IPv4 Structure

An IPv4 address consists of 4 octets (numbers) separated by dots
Each octet is an 8-bit value (ranges from 0 to 255).
Together, the 4 octets form a 32-bit number.

192.168.11.1 means:

Octet 1: 192
Octet 2: 168
Octet 3:  11
Octet 4:   1

------------------------------------------------------------------------------

2. The Mathematical Formula

The conversion treats the IPv4 address as a base-256 (or base-2^8) number, 
where each octet is a "digit" in that base.

The formula is:

Decimal = (a x 256^3) + (b x 256^2) + (c x 256^1) + (d x 256^0)Where the IP is a.b.c.d

This is exactly like how we convert any positional number 
system (e.g., decimal 123 = 1x10^2 + 2x10^1 + 3x10^0), but using 
powers of 256 instead of powers of 10.3. 

Calculation for 192.168.11.1

Let's compute it step by step:

256^0 = 1
256^1 = 256
256^2 = 65,536
256^3 = 16,777,216

Now plug in the values:

192 x 16,777,216 = 3,221,225,472
168 x 65,536     = 11,010,048
11  x 256        = 2,816
1   x 1          = 1

Add them all together:

3,221,225,472 + 11,010,048 + 2,816 + 1 = 3,232,238,337

Final result: 3232238337

This matches the number provided.

-------------------------------------------------------------------------------

4. Why 256

Because each octet is exactly 8 bits:2^8 = 256 possible values per octet (0-255).
Shifting left by 8 bits is the same as multiplying by 256.
The decimal number is simply the integer value of that 32-bit binary number.

--------------------------------------------------------------------------------

5. Quick Python One-Liner (for reference)

(python)
ip = "192.168.11.1"
decimal = sum(int(octet) * (256 ** i) for i, octet in enumerate(reversed(ip.split('.'))))
print(decimal)   # Output: 3232238337

or 

(python)
decimal = int("192.168.11.1".replace('.', ''), 256)   # Also works!


Reverse Conversion (Decimal -> IPv4)

(python)
def decimal_to_ip(n):
    return f"{(n >> 24) & 255}.{(n >> 16) & 255}.{(n >> 8) & 255}.{n & 255}"



-------------------------------------------------------------------------------

6. OS specifics 

UNIX/Linux use inet_aton (or the modern inet_pton in liberal mode).  
It parses the entire string as an unsigned 32-bit integer.  
If the number is larger than 4,294,967,295, it simply wraps around (modulo 2^32) because the internal storage is 32 bits.  

Example (from real inet_aton behavior):  

- 4,294,967,296 -> 0.0.0.0  
- 4,294,967,297 -> 0.0.0.1  
- Any huge number (11+ digits) still works; only the low 32 bits matter.


Windows uses Winsock functions (inet_addr, the parser inside ping.exe, GetAddrInfo, etc.).  
These are stricter about overflow.  
When the input string is a decimal > 2^32-1 (or even sometimes just > ~2^31 in older code), 
the parser either:  

 - Hits an ERANGE / overflow error during string-to-integer conversion 
 - Explicitly rejects it as an invalid IPv4 address.

Windows ping does support small dotless decimals 
(e.g. ping 3232238337 works), but it fails once the 
number exceeds the 32-bit unsigned range and can no 
longer be safely parsed into the internal in_addr structure.


Webserver 1.0