Logo Search packages:      
Sourcecode: qa-assistant version File versions  Download package

def fedoraus::QAFunctions::_hash_file (   self,
  filename,
  hasher 
) [private]

Gets the cryptographic hash of a file.

Attributes:
filename: filename to hash.
hasher: hash object to feed the file to.

This functions returns the hex representation of a hash of a file.

Definition at line 302 of file fedoraus.py.

00302                                           :
        '''Gets the cryptographic hash of a file.
        
        Attributes:
        filename: filename to hash.
        hasher: hash object to feed the file to.

        This functions returns the hex representation of a hash of a file.
        '''
        fh = file(filename, 'r')
        chunk = fh.read(self.__BLOCKSIZE)
        while chunk:
            hasher.update(chunk)
            chunk = fh.read(self.__BLOCKSIZE)
        fh.close()
        return {os.path.basename(filename) : hasher.hexdigest()}
        return {os.path.basename(filename) : hasher.hexdigest()}


Generated by  Doxygen 1.6.0   Back to index