Skip to content

Commit

Permalink
Add testFF3_1_bytes to exercise byte[] ctor
Browse files Browse the repository at this point in the history
  • Loading branch information
altr-benjamin committed Nov 7, 2024
1 parent 4eb3c82 commit 6556460
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/test/java/com/privacylogistics/FF3CipherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void testAcvpFF3_1() throws Exception {
}

@Test
public void testFF3_1() throws Exception {
public void testFF3_1_str() throws Exception {
// Test with 56 bit tweak
String[] testVector = TestVectors[0];
FF3Cipher c = new FF3Cipher(testVector[Tkey], "D8E7920AFA330A", Integer.parseInt(testVector[Tradix]));
Expand All @@ -250,6 +250,18 @@ public void testFF3_1() throws Exception {
assertEquals(pt, plaintext);
}

@Test
public void testFF3_1_bytes() throws Exception {
// Test with 56 bit tweak
String[] testVector = TestVectors[0];
FF3Cipher c = new FF3Cipher(hexStringToByteArray(testVector[Tkey]), hexStringToByteArray("D8E7920AFA330A"), Integer.parseInt(testVector[Tradix]));
String pt = testVector[Tplaintext], ct = "477064185124354662";
String ciphertext = c.encrypt(pt);
String plaintext = c.decrypt(ciphertext);
assertEquals(ct, ciphertext);
assertEquals(pt, plaintext);
}

@Test
@EnabledOnJre(value = JRE.JAVA_11)
public void testCustomAlphabet() throws Exception {
Expand Down

0 comments on commit 6556460

Please sign in to comment.