From 39f79b55ef725daf16de6b9e1f81b9490d6ddc52 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Fri, 11 Apr 2014 13:00:22 +0100
Subject: [PATCH] Ensure ciphertext is always modified in unit test.

---
 .../src/org/briarproject/crypto/PasswordBasedKdfTest.java      | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/briar-tests/src/org/briarproject/crypto/PasswordBasedKdfTest.java b/briar-tests/src/org/briarproject/crypto/PasswordBasedKdfTest.java
index 44dd617e51..151f78fb57 100644
--- a/briar-tests/src/org/briarproject/crypto/PasswordBasedKdfTest.java
+++ b/briar-tests/src/org/briarproject/crypto/PasswordBasedKdfTest.java
@@ -33,8 +33,7 @@ public class PasswordBasedKdfTest extends BriarTestCase {
 		byte[] ciphertext = crypto.encryptWithPassword(input, password);
 		// Modify the ciphertext
 		int position = random.nextInt(ciphertext.length);
-		int value = random.nextInt(256);
-		ciphertext[position] = (byte) value;
+		ciphertext[position] = (byte) (ciphertext[position] ^ 0xFF);
 		byte[] output = crypto.decryptWithPassword(ciphertext, password);
 		assertNull(output);
 	}
-- 
GitLab