aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/twofactor.rst
diff options
context:
space:
mode:
authorDave Brondsema <dave@brondsema.net>2016-08-15 20:13:18 -0400
committerPaul Kehrer <paul.l.kehrer@gmail.com>2016-08-16 08:13:18 +0800
commitc65fea9d54ab122866445f3a8b19e4391f14a7ed (patch)
treea9c1e95f5c08d3b61eed967b38968eb5c822f1b1 /docs/hazmat/primitives/twofactor.rst
parent60cd5a66c28c9e4e5fa7e2b8030dc36ff295259d (diff)
downloadcryptography-c65fea9d54ab122866445f3a8b19e4391f14a7ed.tar.gz
cryptography-c65fea9d54ab122866445f3a8b19e4391f14a7ed.tar.bz2
cryptography-c65fea9d54ab122866445f3a8b19e4391f14a7ed.zip
Update example code to use recommended 160 bits (#3088)
I found the examples with `os.urandom(16)` generated URIs that Google Authenticator and Duo two-factor apps did not even recognize as supported. This increases the key to the recommended 160 bits, and the URIs now work with both of those apps.
Diffstat (limited to 'docs/hazmat/primitives/twofactor.rst')
-rw-r--r--docs/hazmat/primitives/twofactor.rst4
1 files changed, 2 insertions, 2 deletions
diff --git a/docs/hazmat/primitives/twofactor.rst b/docs/hazmat/primitives/twofactor.rst
index 34ca16b7..9f11332f 100644
--- a/docs/hazmat/primitives/twofactor.rst
+++ b/docs/hazmat/primitives/twofactor.rst
@@ -35,7 +35,7 @@ codes (HMAC).
>>> from cryptography.hazmat.backends import default_backend
>>> from cryptography.hazmat.primitives.twofactor.hotp import HOTP
>>> from cryptography.hazmat.primitives.hashes import SHA1
- >>> key = os.urandom(16)
+ >>> key = os.urandom(20)
>>> hotp = HOTP(key, 6, SHA1(), backend=default_backend())
>>> hotp_value = hotp.generate(0)
>>> hotp.verify(hotp_value, 0)
@@ -156,7 +156,7 @@ similar to the following code.
>>> from cryptography.hazmat.backends import default_backend
>>> from cryptography.hazmat.primitives.twofactor.totp import TOTP
>>> from cryptography.hazmat.primitives.hashes import SHA1
- >>> key = os.urandom(16)
+ >>> key = os.urandom(20)
>>> totp = TOTP(key, 8, SHA1(), 30, backend=default_backend())
>>> time_value = time.time()
>>> totp_value = totp.generate(time_value)