diff --git a/lib/ipaddress/ipv4.rb b/lib/ipaddress/ipv4.rb
index 716d4d9593b794e4d3c369f5be2bcc23da76c8ec..0cb30ab65b568a382f217603c2b46a5968980e6d 100644
--- a/lib/ipaddress/ipv4.rb
+++ b/lib/ipaddress/ipv4.rb
@@ -230,6 +230,22 @@ module IPAddress;
     alias_method :to_i, :u32
     alias_method :to_u32, :u32
     
+    #
+    # Returns the address portion in 
+    # hex
+    #
+    #   ip = IPAddress("10.0.0.0")
+    #
+    #   ip.to_h
+    #     #=> 0a000000
+    #
+    def hex
+      hex = @octets.map{|o| o.to_s(16).rjust(2, '0') }.join()
+      "#{hex}"
+    end
+    alias_method :to_h, :hex
+    alias_method :to_hex, :hex   
+
     #
     # Returns the address portion of an IPv4 object
     # in a network byte order format.