summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-05-08 14:12:55 -0700
committerFuwn <[email protected]>2023-05-08 14:12:55 -0700
commitd8c614eff3979a6e7b3c85714bb00ebcb6aec9be (patch)
tree046dc8e7d826c81038b37f3cdbb77a2a09391ceb
parentfix: pedantic for gnu (diff)
downloadcst120-d8c614eff3979a6e7b3c85714bb00ebcb6aec9be.tar.xz
cst120-d8c614eff3979a6e7b3c85714bb00ebcb6aec9be.zip
feat(homework_4): print cipher steps
-rw-r--r--cst120/week_4/homework_4.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cst120/week_4/homework_4.c b/cst120/week_4/homework_4.c
index be274d8..03028bf 100644
--- a/cst120/week_4/homework_4.c
+++ b/cst120/week_4/homework_4.c
@@ -30,6 +30,7 @@ int main(void) {
do {
char *caesar_cipher_encrypted_message = NULL;
char *rail_fence_encrypted_message = NULL;
+ char *caesar_rail_fence_encrypted_message = NULL;
/* Prompt and accept cipher message */
printf("Enter a message: ");
@@ -43,11 +44,15 @@ int main(void) {
*/
caesar_cipher_encrypted_message =
caesar_cipher_encrypt(user_message, &user_key);
- rail_fence_encrypted_message =
+ rail_fence_encrypted_message = rail_fence_encrypt(user_message);
+ caesar_rail_fence_encrypted_message =
rail_fence_encrypt(caesar_cipher_encrypted_message);
/* Output final double-cipher-ed result */
- printf("%s\n", caesar_cipher_encrypted_message);
+ printf("Caesar cipher: %s\n", caesar_cipher_encrypted_message);
+ printf("Rail Fence cipher: %s\n", rail_fence_encrypted_message);
+ printf("Rail Fence + Caesar cipher: %s\n",
+ caesar_rail_fence_encrypted_message);
/* Prompt user to repeat */
printf("Would you like to go again? (y/n) ");