'return hexdigest of hashvalue for this file.'

def computehash(self, hashtype='md5', chunksize=524288):

    try:
        try:
            import hashlib as mod
        except ImportError:
            if (hashtype == 'sha1'):
                hashtype = 'sha'
            mod = __import__(hashtype)
        hash = getattr(mod, hashtype)()
    except (AttributeError, ImportError):
        raise ValueError(("Don't    know    how    to    compute    %r    hash" % (hashtype,)))
    f = self.open('rb')
    try:
        while 1:
            buf = f.read(chunksize)
            if (not buf):
                return hash.hexdigest()
            hash.update(buf)
    finally:
        f.close()
