def test_encrypt_decrypt_fail_wrong_password_kdf_monkeypatch(monkeypatch): monkeypatch.setattr("nacl.pwhash.argon2id.kdf", fast_kdf) ciphertext = encrypt(b"message", b"password") with pytest.raises(nacl.exceptions.CryptoError): assert decrypt(ciphertext, b"hunter2") == b"message"
def test_encrypt_decrypt_success_kdf_monkeypatch(monkeypatch): monkeypatch.setattr("nacl.pwhash.argon2id.kdf", fast_kdf) ciphertext = encrypt(b"message", b"password") assert decrypt(ciphertext, b"password") == b"message"
def ciphertext_with_argon2(): return encrypt(b"message", b"password")
def test_encrypt_decrypt_fail_wrong_password_kdf_monkeypatch(monkeypatch): monkeypatch.setattr('nacl.pwhash.argon2id.kdf', fast_kdf) ciphertext = encrypt(b'message', b'password') with pytest.raises(nacl.exceptions.CryptoError): assert decrypt(ciphertext, b'hunter2') == b'message'
def test_encrypt_decrypt_success_kdf_monkeypatch(monkeypatch): monkeypatch.setattr('nacl.pwhash.argon2id.kdf', fast_kdf) ciphertext = encrypt(b'message', b'password') assert decrypt(ciphertext, b'password') == b'message'
def ciphertext_with_argon2(): return encrypt(b'message', b'password')