- Notifications
You must be signed in to change notification settings - Fork 19.9k
/
Copy pathBlowfishTest.java
38 lines (28 loc) · 888 Bytes
/
BlowfishTest.java
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
packagecom.thealgorithms.ciphers;
importstaticorg.junit.jupiter.api.Assertions.assertEquals;
importorg.junit.jupiter.api.Test;
classBlowfishTest {
Blowfishblowfish = newBlowfish();
@Test
voidtestEncrypt() {
// given
StringplainText = "123456abcd132536";
Stringkey = "aabb09182736ccdd";
StringexpectedOutput = "d748ec383d3405f7";
// when
StringcipherText = blowfish.encrypt(plainText, key);
// then
assertEquals(expectedOutput, cipherText);
}
@Test
voidtestDecrypt() {
// given
StringcipherText = "d748ec383d3405f7";
Stringkey = "aabb09182736ccdd";
StringexpectedOutput = "123456abcd132536";
// when
StringplainText = blowfish.decrypt(cipherText, key);
// then
assertEquals(expectedOutput, plainText);
}
}