aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-02-13 12:27:56 +0800
committerAyrx <terrycwk1994@gmail.com>2014-02-21 11:13:35 +0800
commita7769110ef8f575105847f84cadf6bb5b9aa5fba (patch)
tree9dd292842a82903d1d2c42529250de41515a322c /docs
parentb2ee044298caf5772fb8774dc691add3afe8cdc1 (diff)
downloadcryptography-a7769110ef8f575105847f84cadf6bb5b9aa5fba.tar.gz
cryptography-a7769110ef8f575105847f84cadf6bb5b9aa5fba.tar.bz2
cryptography-a7769110ef8f575105847f84cadf6bb5b9aa5fba.zip
Updated according to code review feedback.
Diffstat (limited to 'docs')
-rw-r--r--docs/hazmat/oath/hotp.rst18
1 files changed, 10 insertions, 8 deletions
diff --git a/docs/hazmat/oath/hotp.rst b/docs/hazmat/oath/hotp.rst
index 614933f9..1dee26b0 100644
--- a/docs/hazmat/oath/hotp.rst
+++ b/docs/hazmat/oath/hotp.rst
@@ -17,18 +17,20 @@ values based on Hash-based message authentication codes (HMAC).
This is an implementation of :rfc:`4226`.
- .. code-block:: python
+ .. doctest::
+ >>> import os
>>> from cryptography.hazmat.backends import default_backend
>>> from cryptography.hazmat.oath.hotp import HOTP
- >>> hotp = HOTP(secret, 6, backend=default_backend)
+
+ >>> key = "12345678901234567890"
+ >>> hotp = HOTP(key, 6, backend=default_backend())
>>> hotp.generate(0)
- 958695
- >>> hotp.verify("958695", 0)
- True
+ '755224'
+ >>> hotp.verify("755224", 0)
- :param secret: Secret key as ``bytes``.
- :param length: Length of generated one time password as ``int``.
+ :param bytes secret: Secret key as ``bytes``.
+ :param int length: Length of generated one time password as ``int``.
:param backend: A
:class:`~cryptography.hazmat.backends.interfaces.HMACBackend`
provider.
@@ -36,7 +38,7 @@ values based on Hash-based message authentication codes (HMAC).
.. method:: generate(counter)
:param int counter: The counter value used to generate the one time password.
- :return: A one time password value.
+ :return bytes: A one time password value.
.. method:: verify(hotp, counter)