summaryrefslogtreecommitdiff
path: root/otp2289/generator.py
diff options
context:
space:
mode:
authorSimeon Simeonov2020-12-04 12:36:58 +0100
committerSimeon Simeonov2020-12-04 12:36:58 +0100
commit7498bf51d85f98d67d72193dc01db2afb83aeaf3 (patch)
treef92f504d3d056dbb09e10c63f06e17201d2b76f1 /otp2289/generator.py
parentc1378156e2ae02c37d0b19b033cad20f72bcd37d (diff)
Raise exceptions from except properly
Diffstat (limited to 'otp2289/generator.py')
-rw-r--r--otp2289/generator.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/otp2289/generator.py b/otp2289/generator.py
index 723ed04..5ea738b 100644
--- a/otp2289/generator.py
+++ b/otp2289/generator.py
@@ -407,7 +407,7 @@ class OTPGenerator:
407 hash_algo, step, seed = challenge[4:].split() 407 hash_algo, step, seed = challenge[4:].split()
408 return (seed, hash_algo, int(step)) 408 return (seed, hash_algo, int(step))
409 except ValueError: 409 except ValueError:
410 raise OTPChallengeException('Invalid challenge') 410 raise OTPChallengeException('Invalid challenge') from None
411 411
412 @staticmethod 412 @staticmethod
413 def sha1_digest_folding(sha1_digest): 413 def sha1_digest_folding(sha1_digest):
@@ -506,7 +506,7 @@ class OTPGenerator:
506 tokens] 506 tokens]
507 except ValueError: 507 except ValueError:
508 raise OTPGeneratorException( 508 raise OTPGeneratorException(
509 'One or more words not present in RFC1760') 509 'One or more words not present in RFC1760') from None
510 # now we build a string of bits 510 # now we build a string of bits
511 bit_stream = format(token_ints[0], '011b') 511 bit_stream = format(token_ints[0], '011b')
512 bit_stream += format(token_ints[1], '011b') 512 bit_stream += format(token_ints[1], '011b')