hash pylint fixes

This commit is contained in:
lakshyacis 2019-09-23 17:52:56 +05:30
parent e0d81bb7e8
commit 4448e6ee7b
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

@ -1,6 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""
src/pyelliptic/hash.py
=====================
"""
# Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com> # Copyright (C) 2011 Yann GUIBET <yannguibet@gmail.com>
# See LICENSE for details. # See LICENSE for details.
@ -30,8 +33,7 @@ def equals(a, b):
"""Compare two strings or bytearrays""" """Compare two strings or bytearrays"""
if isinstance(a, str): if isinstance(a, str):
return _equals_str(a, b) return _equals_str(a, b)
else: return _equals_bytes(a, b)
return _equals_bytes(a, b)
def hmac_sha256(k, m): def hmac_sha256(k, m):
@ -59,7 +61,7 @@ def hmac_sha512(k, m):
def pbkdf2(password, salt=None, i=10000, keylen=64): def pbkdf2(password, salt=None, i=10000, keylen=64):
"""Compute the salt, key and the message with pbkdf2""" """Key derivation function using SHA256"""
if salt is None: if salt is None:
salt = OpenSSL.rand(8) salt = OpenSSL.rand(8)
p_password = OpenSSL.malloc(password, len(password)) p_password = OpenSSL.malloc(password, len(password))