From 3b6423dc2a10320d739554e88c1384a8e8a068c2 Mon Sep 17 00:00:00 2001 From: Ayrx Date: Sun, 23 Feb 2014 12:40:13 +0800 Subject: Updated HOTP and TOTP doctests --- docs/hazmat/primitives/twofactor.rst | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'docs/hazmat') 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 -- cgit v1.2.3