[Python-checkins] peps: add hash algorithm agility to RECORD

daniel.holth python-checkins at python.org
Sun Sep 16 19:27:19 CEST 2012


http://hg.python.org/peps/rev/75c492a5e23b
changeset:   4511:75c492a5e23b
user:        Daniel Holth <dholth at fastmail.fm>
date:        Sat Sep 15 08:10:49 2012 -0400
summary:
  add hash algorithm agility to RECORD

files:
  pep-0376.txt |  20 +++++++++++++-------
  1 files changed, 13 insertions(+), 7 deletions(-)


diff --git a/pep-0376.txt b/pep-0376.txt
--- a/pep-0376.txt
+++ b/pep-0376.txt
@@ -218,11 +218,17 @@
 
   - an absolute path, using the local platform separator
 
-- the **MD5** hash of the file, encoded in hex. Notice that `pyc` and `pyo`
-  generated files don't have any hash because they are automatically produced
-  from `py` files. So checking the hash of the corresponding `py` file is
-  enough to decide if the file and its associated `pyc` or `pyo` files have
-  changed.
+- a hash of the file's contents.
+  Notice that `pyc` and `pyo` generated files don't have any hash because
+  they are automatically produced from `py` files. So checking the hash
+  of the corresponding `py` file is enough to decide if the file and
+  its associated `pyc` or `pyo` files have changed.
+
+  The hash is either the empty string, the **MD5** hash of
+  the file, encoded in hex, or the hash algorithm as named in
+  ``hashlib.algorithms_guaranteed``, followed by the equals character
+  ``=``, followed by the urlsafe-base64-nopad encoding of the digest 
+  (``base64.urlsafe_b64encode(digest)`` with trailing ``=`` removed).
 
 - the file's size in bytes
 
@@ -391,9 +397,9 @@
 
 And following methods:
 
-- ``get_installed_files(local=False)`` -> iterator of (path, md5, size)
+- ``get_installed_files(local=False)`` -> iterator of (path, hash, size)
 
-  Iterates over the `RECORD` entries and return a tuple ``(path, md5, size)``
+  Iterates over the `RECORD` entries and return a tuple ``(path, hash, size)``
   for each line. If ``local`` is ``True``, the path is transformed into a
   local absolute path. Otherwise the raw value from `RECORD` is returned.
 

-- 
Repository URL: http://hg.python.org/peps


More information about the Python-checkins mailing list