aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/constant-time.rst
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-05 15:44:08 -0600
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-02-05 15:44:08 -0600
commitc91f2392f9cd5b63e1d0440ce851db768944964a (patch)
treeb21a3eab441b72ef3b1f1fe5545a8895c9c32702 /docs/hazmat/primitives/constant-time.rst
parent27864789563c90edb42772a9af1602be87029abc (diff)
parentf970eaa676eb0cd89cdb2389f03d365899812822 (diff)
downloadcryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.tar.gz
cryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.tar.bz2
cryptography-c91f2392f9cd5b63e1d0440ce851db768944964a.zip
Merge branch 'master' into urandom-engine
* master: PKCS #1 RSA test vector loader Removed pointless anchor Docs need virtualenv as well Everything about bash is the worst Some reST markup nonsense Fix for OS X More clearly describe the behavior of constant_time.bytes_eq Run the doc tests under OS X Made OpenSSL's derive_pbkdf2_hmac raise the right exception Document which backends implement which itnerfaces. Fixes #538 pep8 Fixed a typo in the docs Make the default backend be a multi-backend Conflicts: tests/hazmat/backends/test_openssl.py
Diffstat (limited to 'docs/hazmat/primitives/constant-time.rst')
-rw-r--r--docs/hazmat/primitives/constant-time.rst13
1 files changed, 8 insertions, 5 deletions
diff --git a/docs/hazmat/primitives/constant-time.rst b/docs/hazmat/primitives/constant-time.rst
index 632e7c68..c6fcb3a3 100644
--- a/docs/hazmat/primitives/constant-time.rst
+++ b/docs/hazmat/primitives/constant-time.rst
@@ -19,8 +19,10 @@ about the timing attacks on KeyCzar and Java's ``MessageDigest.isEqual()``.
.. function:: bytes_eq(a, b)
- Compare ``a`` and ``b`` to one another in constant time if they are of the
- same length.
+ Compares ``a`` and ``b`` with one another. If ``a`` and ``b`` have
+ different lengths, this returns ``False`` immediately. Otherwise it
+ compares them in a way that takes the same amount of time, regardless of
+ how many characters are the same between the two.
.. doctest::
@@ -30,9 +32,10 @@ about the timing attacks on KeyCzar and Java's ``MessageDigest.isEqual()``.
>>> constant_time.bytes_eq(b"foo", b"bar")
False
- :param a bytes: The left-hand side.
- :param b bytes: The right-hand side.
- :returns boolean: True if ``a`` has the same bytes as ``b``.
+ :param bytes a: The left-hand side.
+ :param bytes b: The right-hand side.
+ :returns bool: ``True`` if ``a`` has the same bytes as ``b``, otherwise
+ ``False``.
.. _`Coda Hale's blog post`: http://codahale.com/a-lesson-in-timing-attacks/