commit 151a45911f028b1b466e001a0fd8fad467d60bf1
parent 9740744d70461d9b0f02a78f836784bc91ff2d1a
Author: SomberNight <somber.night@protonmail.com>
Date: Wed, 10 Mar 2021 17:31:02 +0100
follow-up prev: too much copy-paste
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/electrum/crypto.py b/electrum/crypto.py
@@ -338,7 +338,7 @@ def chacha20_poly1305_encrypt(
assert isinstance(nonce, (bytes, bytearray))
assert isinstance(associated_data, (bytes, bytearray, type(None)))
assert isinstance(data, (bytes, bytearray))
- assert len(key) == 32, f"unexpected key size: {len(nonce)} (expected: 32)"
+ assert len(key) == 32, f"unexpected key size: {len(key)} (expected: 32)"
assert len(nonce) == 12, f"unexpected nonce size: {len(nonce)} (expected: 12)"
if HAS_CRYPTODOME:
cipher = CD_ChaCha20_Poly1305.new(key=key, nonce=nonce)
@@ -363,7 +363,7 @@ def chacha20_poly1305_decrypt(
assert isinstance(nonce, (bytes, bytearray))
assert isinstance(associated_data, (bytes, bytearray, type(None)))
assert isinstance(data, (bytes, bytearray))
- assert len(key) == 32, f"unexpected key size: {len(nonce)} (expected: 32)"
+ assert len(key) == 32, f"unexpected key size: {len(key)} (expected: 32)"
assert len(nonce) == 12, f"unexpected nonce size: {len(nonce)} (expected: 12)"
if HAS_CRYPTODOME:
cipher = CD_ChaCha20_Poly1305.new(key=key, nonce=nonce)
@@ -384,7 +384,7 @@ def chacha20_encrypt(*, key: bytes, nonce: bytes, data: bytes) -> bytes:
assert isinstance(key, (bytes, bytearray))
assert isinstance(nonce, (bytes, bytearray))
assert isinstance(data, (bytes, bytearray))
- assert len(key) == 32, f"unexpected key size: {len(nonce)} (expected: 32)"
+ assert len(key) == 32, f"unexpected key size: {len(key)} (expected: 32)"
assert len(nonce) in (8, 12), f"unexpected nonce size: {len(nonce)} (expected: 8 or 12)"
if HAS_CRYPTODOME:
cipher = CD_ChaCha20.new(key=key, nonce=nonce)
@@ -402,7 +402,7 @@ def chacha20_decrypt(*, key: bytes, nonce: bytes, data: bytes) -> bytes:
assert isinstance(key, (bytes, bytearray))
assert isinstance(nonce, (bytes, bytearray))
assert isinstance(data, (bytes, bytearray))
- assert len(key) == 32, f"unexpected key size: {len(nonce)} (expected: 32)"
+ assert len(key) == 32, f"unexpected key size: {len(key)} (expected: 32)"
assert len(nonce) in (8, 12), f"unexpected nonce size: {len(nonce)} (expected: 8 or 12)"
if HAS_CRYPTODOME:
cipher = CD_ChaCha20.new(key=key, nonce=nonce)