--- ipkg.py
+++ ipkg.py
@@ -36,12 +36,17 @@
 import os
 import sys
 import glob
-import md5
 import re
 import string
 import commands
 from stat import ST_SIZE
 
+try:
+    from hashlib import md5
+except ImportError:
+    import md5
+    md5 = md5.new
+
 class Version:
     """A class for holding parsed package version information."""
     def __init__(self, epoch, version):
@@ -136,7 +141,7 @@
 
             # compute the MD5.
             f = open(fn, "r")
-            sum = md5.new()
+            sum = md5()
             while 1:
                 data = f.read(1024)
                 if not data: break
