Fixed invalid check for None
This commit is contained in:
parent
e28dbd4afa
commit
d5e0a461cf
@ -33,7 +33,7 @@ def hkdf(length=None, derive_from=None, salt=None, context=None):
|
|||||||
if length == None or length < 1:
|
if length == None or length < 1:
|
||||||
raise ValueError("Invalid output key length")
|
raise ValueError("Invalid output key length")
|
||||||
|
|
||||||
if derive_from == "None" or derive_from == "":
|
if derive_from == None or derive_from == "":
|
||||||
raise ValueError("Cannot derive key from empty input material")
|
raise ValueError("Cannot derive key from empty input material")
|
||||||
|
|
||||||
if salt == None or len(salt) == 0:
|
if salt == None or len(salt) == 0:
|
||||||
@ -54,4 +54,4 @@ def hkdf(length=None, derive_from=None, salt=None, context=None):
|
|||||||
block = hmac_sha256(pseudorandom_key, block + context + bytes([i + 1]))
|
block = hmac_sha256(pseudorandom_key, block + context + bytes([i + 1]))
|
||||||
derived += block
|
derived += block
|
||||||
|
|
||||||
return derived[:length]
|
return derived[:length]
|
||||||
|
Loading…
Reference in New Issue
Block a user