-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding tests cases for the 3 new ciphers
- Loading branch information
Lucas Swartsenburg
committed
Dec 11, 2023
1 parent
0fbf793
commit dae69d7
Showing
4 changed files
with
69 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from cipher_algorithms.ciphers.base64.algo import ( | ||
encrypt, | ||
decrypt, | ||
) | ||
|
||
|
||
def test_base64_encrypt(): | ||
plaintext = "testingabc" | ||
cipher = encrypt(plaintext) | ||
|
||
assert cipher == "dGVzdGluZ2FiYw==" | ||
|
||
|
||
def test_base64_decrypt(): | ||
cipher = "dGVzdGluZ2FiYw==" | ||
plaintext = decrypt(cipher) | ||
|
||
assert plaintext == "testingabc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from cipher_algorithms.ciphers.hill.algo import ( | ||
encrypt, | ||
decrypt, | ||
) | ||
|
||
|
||
def test_hill_encrypt(): | ||
plaintext = "TESTINGABC" | ||
key = "HELLO" | ||
cipher = encrypt(plaintext, key) | ||
|
||
assert cipher == "VQXVRTQYDA" | ||
|
||
|
||
def test_hill_decrypt(): | ||
plaintext = "VQXVRTQYDA" | ||
key = "HELLO" | ||
cipher = decrypt(plaintext, key) | ||
|
||
assert cipher == "TESTINGABC" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from cipher_algorithms.ciphers.playfair.algo import ( | ||
encrypt, | ||
decrypt, | ||
) | ||
|
||
|
||
def test_playfair_encrypt(): | ||
plaintext = "TESTINGABC" | ||
key = "HELLO" | ||
cipher = encrypt(plaintext, key) | ||
|
||
assert cipher == "ROTUKPPGCD" | ||
|
||
|
||
def test_playfair_decrypt(): | ||
plaintext = "ROTUKPPGCD" | ||
key = "HELLO" | ||
cipher = decrypt(plaintext, key) | ||
|
||
assert cipher == "TESTINGABC" |