Revert "switch to md5; adjust format a bit"
This reverts commit d027ce144b
.
This commit is contained in:
parent
d027ce144b
commit
70b6d5aac9
14
pep-0552.txt
14
pep-0552.txt
|
@ -59,12 +59,13 @@ Python will begin to recognize two magic number variants for every pyc
|
||||||
version. One magic number will correspond to the current pyc format and the
|
version. One magic number will correspond to the current pyc format and the
|
||||||
other to "hash-based" pycs introduced by this PEP.
|
other to "hash-based" pycs introduced by this PEP.
|
||||||
|
|
||||||
In hash-based pycs, the second 32-bit field in the pyc header (currently the
|
In hash-based pycs, the second field in the pyc header (currently the
|
||||||
"timestamp" field) will become a bitset of flags. We define the lowest flag in
|
"timestamp" field) will contain the SipHash_ (with a hardcoded key) of the
|
||||||
this bitset called ``check_source``. This bitset field is followed by a 128-bit
|
contents of the source file. Another a fast hash like MD5 or BLAKE2_ would also
|
||||||
MD5 hash field. We choose MD5 because it is fast and sufficiently collision
|
work. We choose SipHash because Python already has a builtin implementation of
|
||||||
resistant for this application. No strong security properties are required
|
it from :pep:`456`. The third field in the pyc header (currently the "source
|
||||||
here. (A truncated BLAKE2_ hash would also work.)
|
size" field) will become a bitset of flags. We define the lowest flag in this
|
||||||
|
bitset called ``check_source``
|
||||||
|
|
||||||
When Python encounters a hash-based pyc, its behavior depends on the setting of
|
When Python encounters a hash-based pyc, its behavior depends on the setting of
|
||||||
the ``check_source`` flag. If the ``check_source`` flag is set, Python will
|
the ``check_source`` flag. If the ``check_source`` flag is set, Python will
|
||||||
|
@ -93,6 +94,7 @@ References
|
||||||
.. _reproducible build: https://reproducible-builds.org/
|
.. _reproducible build: https://reproducible-builds.org/
|
||||||
.. _Bazel: https://bazel.build/
|
.. _Bazel: https://bazel.build/
|
||||||
.. _BLAKE2: https://blake2.net/
|
.. _BLAKE2: https://blake2.net/
|
||||||
|
.. _SipHash: https://131002.net/siphash/
|
||||||
.. [#frozensets] http://benno.id.au/blog/2013/01/15/python-determinism
|
.. [#frozensets] http://benno.id.au/blog/2013/01/15/python-determinism
|
||||||
.. [#interning] http://bugzilla.opensuse.org/show_bug.cgi?id=1049186
|
.. [#interning] http://bugzilla.opensuse.org/show_bug.cgi?id=1049186
|
||||||
.. _magic number: https://docs.python.org/3/library/importlib.html#importlib.util.MAGIC_NUMBER
|
.. _magic number: https://docs.python.org/3/library/importlib.html#importlib.util.MAGIC_NUMBER
|
||||||
|
|
Loading…
Reference in New Issue