Skip to content

Instantly share code, notes, and snippets.

@Markonis
Created March 18, 2019 15:33
Show Gist options
  • Save Markonis/66e6905c13f6e9a2482d0526e8fccce5 to your computer and use it in GitHub Desktop.
Save Markonis/66e6905c13f6e9a2482d0526e8fccce5 to your computer and use it in GitHub Desktop.
public class TeaTest {
@Test
public void testEncryptDecryptBlock() {
Configuration config = new Configuration();
config.set("blockLength", "8");
config.set("key", "111 222 333 444");
Tea instance = new Tea(config);
for(int i = 0; i < 1024; i++){
int[] inputBlock = new int[8];
for(int j = 0; j < 8; j++)
inputBlock[j] = (int) Math.floor(Math.random() * 256);
int[] encryptedBlock = instance.encryptBlock(inputBlock);
int[] decryptedBlock = instance.decryptBlock(encryptedBlock);
Assert.assertArrayEquals(inputBlock, decryptedBlock);
}
}
// Rest of the code deleted for brevity...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment