changeset b339386c6111 in /home/hg/repos/python-nbxmpp
details:http://hg.gajim.org/python-nbxmpp?cmd=changeset;node=b339386c6111 description: prefer sha-1
diffstat:
nbxmpp/protocol.py | 16 ++++++---------- 1 files changed, 6 insertions(+), 10 deletions(-)
diffs (44 lines):
diff -r 5812cedb80f0 -r b339386c6111 nbxmpp/protocol.py --- a/nbxmpp/protocol.py Mon Dec 24 14:55:21 2012 -0400 +++ b/nbxmpp/protocol.py Thu Dec 27 19:17:02 2012 -0400 @@ -1070,34 +1070,30 @@ hash_ = None # file_string can be a string or a file if type(file_string) == str: # if it is a string - if algo == 'md5': + if algo == 'sha-1': + hl = hashlib.sha1() + elif algo == 'md5': hl = hashlib.md5() - elif algo == 'sha-1': - hl = hashlib.sha1() elif algo == 'sha-256': hl = hashlib.sha256() elif algo == 'sha-512': hl = hashlib.sha512() - if hl: hl.update(file_string) hash_ = hl.hexdigest() else: # if it is a file - - if algo == 'md5': + if algo == 'sha-1': + hl = hashlib.sha1() + elif algo == 'md5': hl = hashlib.md5() - elif algo == 'sha-1': - hl = hashlib.sha1() elif algo == 'sha-256': hl = hashlib.sha256() elif algo == 'sha-512': hl = hashlib.sha512() - if hl: for line in file_string: hl.update(line) hash_ = hl.hexdigest() - return hash_
def addHash(self, hash_, algo):