diff options
author | Jefry Lagrange <jefry.reyes@gmail.com> | 2012-01-25 01:51:26 +0400 |
---|---|---|
committer | Jefry Lagrange <jefry.reyes@gmail.com> | 2012-01-25 01:51:26 +0400 |
commit | b2897e36bbbf8bf4ba5746421fd108b4f9140ad3 (patch) | |
tree | a6c63a6d36df84c79a33ba25cbe0f38a3a7563d4 /src/common/xmpp | |
parent | c02b43f88f04a58d770e3eca059dfb40b86222cf (diff) |
better way to handle non supported hash algorithms
Diffstat (limited to 'src/common/xmpp')
-rw-r--r-- | src/common/xmpp/protocol.py | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/common/xmpp/protocol.py b/src/common/xmpp/protocol.py index 007549691..3a8f092a7 100644 --- a/src/common/xmpp/protocol.py +++ b/src/common/xmpp/protocol.py @@ -1078,10 +1078,7 @@ class Hashes(Node): elif algo == 'sha-512': hl = hashlib.sha512() - if hl == None: - # Raise exception - raise Exception('Hash algorithm not supported') - else: + if hl: hl.update(file_string) hash_ = hl.hexdigest() else: # if it is a file @@ -1095,10 +1092,7 @@ class Hashes(Node): elif algo == 'sha-512': hl = hashlib.sha512() - if hl == None: - # Raise exception - raise Exception('Hash algorithm not supported') - else: + if hl: for line in file_string: hl.update(line) hash_ = hl.hexdigest() |