def _calc_digest(self, origin):
        """calculate digest for the given file or readable/seekable object

         Args:
            origin -- could be the path of a file or a readable/seekable object ( fileobject, stream, stringIO...)
         Returns:
            String rapresenting the digest for the given origin
        """
        if hasattr(origin, 'read') and hasattr(origin, 'seek'):
            pos = origin.tell()
            digest = hashtools.calc_digest(origin, algorithm=self._conf['hash_alg'])
            origin.seek(pos)
        else:
            digest = hashtools.calc_file_digest(origin, algorithm=self._conf['hash_alg'])
        return digest