aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/twofactor.rst
diff options
context:
space:
mode:
authorAyrx <terrycwk1994@gmail.com>2014-02-23 12:40:13 +0800
committerAyrx <terrycwk1994@gmail.com>2014-02-25 10:36:32 +0800
commit3b6423dc2a10320d739554e88c1384a8e8a068c2 (patch)
treec79917452bda0d2d64e9807d9f18fb40a4e382a8 /docs/hazmat/primitives/twofactor.rst
parent52e1e930880456e69b9a0fdd371337225fc3511b (diff)
downloadcryptography-3b6423dc2a10320d739554e88c1384a8e8a068c2.tar.gz
cryptography-3b6423dc2a10320d739554e88c1384a8e8a068c2.tar.bz2
cryptography-3b6423dc2a10320d739554e88c1384a8e8a068c2.zip
Updated HOTP and TOTP doctests
Diffstat (limited to 'docs/hazmat/primitives/twofactor.rst')
-rw-r--r--docs/hazmat/primitives/twofactor.rst11
1 files changed, 5 insertions, 6 deletions
diff --git a/docs/hazmat/primitives/twofactor.rst b/docs/hazmat/primitives/twofactor.rst
index 2e170b85..ca18c50b 100644
--- a/docs/hazmat/primitives/twofactor.rst
+++ b/docs/hazmat/primitives/twofactor.rst
@@ -32,9 +32,8 @@ codes (HMAC).
>>> from cryptography.hazmat.primitives.hashes import SHA1
>>> key = os.urandom(16)
>>> hotp = HOTP(key, 6, SHA1(), backend=default_backend())
- >>> hotp.generate(0) # doctest: +SKIP
- '755224'
- >>> hotp.verify(b"755224", 0) # doctest: +SKIP
+ >>> hotp_value = hotp.generate(0)
+ >>> hotp.verify(hotp_value, 0)
:param bytes key: Per-user secret key. This value must be kept secret
and be at least 128 bits. It is recommended that the
@@ -120,9 +119,9 @@ This can be accomplished with something similar to the following code.
>>> from cryptography.hazmat.primitives.hashes import SHA1
>>> key = os.urandom(16)
>>> totp = TOTP(key, 8, SHA1(), 30, backend=default_backend())
- >>> totp.generate(time.time()) # doctest: +SKIP
- '94287082'
- >>> totp.verify(b"94287082", 59) # doctest: +SKIP
+ >>> time_value = time.time()
+ >>> totp_value = totp.generate(time_value)
+ >>> totp.verify(totp_value, time_value)
:param bytes key: Per-user secret key. This value must be kept secret
and be at least 128 bits. It is recommended that the