Package portage :: Module checksum
[hide private]

Module checksum

source code

Functions [hide private]
 
_generate_hash_function(hashtype, hashobject, origin='unknown') source code
 
sha1hash(filename)
Run a checksum against a file.
source code
 
sha256hash(filename)
Run a checksum against a file.
source code
 
rmd160() source code
 
rmd160hash(filename)
Run a checksum against a file.
source code
 
md5hash(filename)
Run a checksum against a file.
source code
 
getsize(filename) source code
 
perform_md5(x, calc_prelink=0) source code
 
perform_all(x, calc_prelink=0) source code
 
get_valid_checksum_keys() source code
 
get_hash_origin(hashtype) source code
Tuple
verify_all(filename, mydict, calc_prelink=0, strict=0)
Verify all checksums against a file.
source code
Tuple
perform_checksum(filename, hashname='MD5', calc_prelink=0)
Run a specific checksum against a file.
source code
Tuple
perform_multiple_checksums(filename, hashes=['MD5'], calc_prelink=0)
Run a group of checksums against a file.
source code
Variables [hide private]
  hashfunc_map = {}
  hashorigin_map = {'MD5': 'hashlib', 'RMD160': 'hashlib', 'SHA1...
  prelink_capable = False

Imports: PRIVATE_PATH, PRELINK_BINARY, HASHING_BLOCKSIZE, os, errno, stat, tempfile, portage, commands, _new_md5, _new_sha1, MD5, SHA, SHA256, RIPEMD, hashlib, fchksum


Function Details [hide private]

sha1hash(filename)

source code 

Run a checksum against a file.

Parameters:
  • filename (String) - File to run the checksum against
Returns:
The hash and size of the data

sha256hash(filename)

source code 

Run a checksum against a file.

Parameters:
  • filename (String) - File to run the checksum against
Returns:
The hash and size of the data

rmd160hash(filename)

source code 

Run a checksum against a file.

Parameters:
  • filename (String) - File to run the checksum against
Returns:
The hash and size of the data

md5hash(filename)

source code 

Run a checksum against a file.

Parameters:
  • filename (String) - File to run the checksum against
Returns:
The hash and size of the data

verify_all(filename, mydict, calc_prelink=0, strict=0)

source code 

Verify all checksums against a file.

Parameters:
  • filename (String) - File to run the checksums against
  • calc_prelink (Integer) - Whether or not to reverse prelink before running the checksum
  • strict (Integer) - Enable/Disable strict checking (which stops exactly at a checksum failure and throws an exception)
Returns: Tuple
Result of the checks and possible message: 1) If size fails, False, and a tuple containing a message, the given size, and the actual size 2) If there is an os error, False, and a tuple containing the system error followed by 2 nulls 3) If a checksum fails, False and a tuple containing a message, the given hash, and the actual hash 4) If all checks succeed, return True and a fake reason

perform_checksum(filename, hashname='MD5', calc_prelink=0)

source code 

Run a specific checksum against a file.

Parameters:
  • filename (String) - File to run the checksum against
  • hashname (String) - The type of hash function to run
  • calc_prelink (Integer) - Whether or not to reverse prelink before running the checksum
Returns: Tuple
The hash and size of the data

perform_multiple_checksums(filename, hashes=['MD5'], calc_prelink=0)

source code 

Run a group of checksums against a file.

Parameters:
  • filename (String) - File to run the checksums against
  • hashes - A list of checksum functions to run against the file
  • calc_prelink (Integer) - Whether or not to reverse prelink before running the checksum
  • hashname (List)
Returns: Tuple
A dictionary in the form: return_value[hash_name] = (hash_result,size) for each given checksum

Variables Details [hide private]

hashorigin_map

Value:
{'MD5': 'hashlib',
 'RMD160': 'hashlib',
 'SHA1': 'hashlib',
 'SHA256': 'hashlib'}