forked from TheAlgorithms/Java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBlowfishTest.java
More file actions
38 lines (28 loc) · 888 Bytes
/
BlowfishTest.java
File metadata and controls
38 lines (28 loc) · 888 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.thealgorithms.ciphers;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
class BlowfishTest {
Blowfish blowfish = new Blowfish();
@Test
void testEncrypt() {
// given
String plainText = "123456abcd132536";
String key = "aabb09182736ccdd";
String expectedOutput = "d748ec383d3405f7";
// when
String cipherText = blowfish.encrypt(plainText, key);
// then
assertEquals(expectedOutput, cipherText);
}
@Test
void testDecrypt() {
// given
String cipherText = "d748ec383d3405f7";
String key = "aabb09182736ccdd";
String expectedOutput = "123456abcd132536";
// when
String plainText = blowfish.decrypt(cipherText, key);
// then
assertEquals(expectedOutput, plainText);
}
}