From 3a2e110ad2a6fb37835bc2839401a440f364e245 Mon Sep 17 00:00:00 2001 From: geoffrey Date: Sun, 29 Sep 2024 18:30:53 +0200 Subject: [PATCH] Upgrade polybius --- examples/poem.txt.crypt | 1 + examples/sonnet116.txt | 16 ++++++++ src/functions.h | 2 +- src/main.c | 2 + src/polybius.c | 83 ++++++++++++++++++++++++++++++++++++++--- src/polybius.h | 1 + 6 files changed, 98 insertions(+), 7 deletions(-) create mode 100644 examples/sonnet116.txt diff --git a/examples/poem.txt.crypt b/examples/poem.txt.crypt index e69de29..a6b746d 100644 --- a/examples/poem.txt.crypt +++ b/examples/poem.txt.crypt @@ -0,0 +1 @@ +02 03 20 24 00 31 33 00 33 01 13 33 03 24 11 01 23 01 30 14 01 00 30 23 04 01 13 01 24 30 34 42 01 34 24 01 20 22 03 40 03 20 00 01 24 10 30 33 11 01 22 30 24 13 02 30 34 33 02 31 03 33 23 20 24 30 34 02 20 22 24 01 24 03 31 03 02 10 30 23 31 00 22 01 24 30 23 04 33 01 20 22 00 03 20 00 10 01 00 13 01 30 22 01 04 30 24 14 01 34 33 12 22 01 34 33 20 00 20 22 03 10 30 24 02 20 11 33 22 03 10 33 30 20 42 11 01 02 34 02 10 14 33 20 02 00 00 30 34 00 01 33 03 43 30 24 24 03 24 00 01 11 03 24 02 22 30 23 04 33 01 20 22 03 11 20 00 10 01 02 00 22 01 11 20 01 34 11 01 31 33 30 13 33 02 01 00 11 03 23 30 34 33 02 34 02 32 34 20 40 30 20 00 00 30 24 12 33 30 24 00 10 33 30 20 00 40 30 20 33 22 01 12 33 30 24 00 11 34 30 34 33 10 14 33 20 02 00 02 30 34 33 20 00 32 34 20 22 01 33 01 31 30 34 02 02 01 31 34 20 02 32 34 20 22 01 02 00 23 30 33 00 31 30 34 33 24 30 34 02 01 40 01 34 42 23 30 34 33 20 33 31 30 34 33 22 34 20 11 03 24 02 02 30 24 00 30 23 04 01 03 34 11 30 24 00 03 20 22 03 31 20 01 33 33 01 31 30 34 33 03 31 31 34 20 20 22 23 03 31 31 01 22 22 01 11 34 24 01 40 30 20 42 11 30 34 10 01 02 03 11 30 10 00 33 20 24 01 01 02 00 22 01 10 20 01 22 01 24 00 33 30 34 40 01 33 00 31 03 33 22 03 23 03 20 24 10 30 23 23 01 34 24 31 33 01 22 01 24 12 03 24 00 20 22 00 20 01 24 00 22 01 13 01 24 33 01 14 34 23 03 20 24 31 03 33 22 34 20 24 30 34 02 40 20 40 30 24 02 01 00 24 30 34 02 02 30 23 23 01 02 03 34 10 14 01 40 01 00 11 01 02 13 01 22 20 01 33 02 11 30 33 23 03 24 00 11 03 24 02 22 01 34 33 02 23 03 20 02 30 24 02 20 22 11 33 30 04 01 22 01 02 10 22 01 12 02 11 01 00 30 34 00 01 02 22 01 02 31 33 20 02 30 24 02 01 00 23 01 00 01 24 22 20 04 01 33 00 22 01 02 14 30 23 23 01 02 30 33 20 22 01 02 00 22 30 20 24 11 01 24 30 34 02 34 24 01 03 34 00 33 01 14 34 23 03 24 20 00 32 34 20 24 01 22 01 10 30 24 24 03 00 31 30 20 24 00 01 00 11 03 24 02 22 20 24 20 32 34 20 00 33 03 23 31 01 01 24 10 14 03 24 01 01 00 02 30 34 12 12 33 01 01 00 00 30 23 04 01 20 22 02 12 30 24 00 31 30 34 33 00 33 30 34 40 01 33 11 20 01 34 11 01 00 24 04 33 01 34 42 01 12 12 30 33 00 02 20 22 02 02 03 13 20 00 01 24 00 01 24 40 03 20 24 20 22 02 02 30 24 00 10 30 23 23 01 11 01 02 23 30 33 00 02 32 34 20 00 00 01 24 00 22 01 23 34 33 11 01 22 01 34 33 00 30 23 04 01 02 03 24 02 22 30 20 02 03 24 02 04 34 00 02 03 24 02 13 34 20 11 01 20 22 02 01 33 33 01 24 00 20 10 20 04 03 02 20 22 02 02 30 24 00 23 10 14 03 24 00 02 00 03 24 00 20 13 24 30 33 03 24 00 02 20 22 02 24 30 24 00 31 03 02 22 01 34 33 31 03 33 00 11 01 22 03 13 33 03 24 11 01 10 30 24 32 34 00 01 20 33 03 20 31 30 34 33 22 01 02 02 03 34 40 01 33 01 32 34 20 00 00 01 22 01 02 03 20 24 00 22 20 01 34 23 01 02 12 33 33 01 02 01 40 20 01 24 02 40 30 34 02 03 31 31 30 33 00 01 33 23 30 24 11 20 01 34 01 40 20 01 24 02 40 30 34 02 03 31 31 30 33 00 01 33 23 03 00 00 01 31 33 00 33 01 20 22 02 01 02 00 02 30 34 40 01 24 34 10 03 22 23 01 01 24 24 30 02 30 34 33 02 00 33 30 34 04 22 02 11 01 22 03 31 03 33 30 22 01 11 20 00 01 03 34 42 03 31 00 33 01 02 03 22 22 01 44 04 33 03 40 01 44 22 01 02 04 10 14 01 33 02 01 00 22 01 02 10 22 03 20 01 02 01 00 11 01 22 03 11 20 01 34 11 34 10 14 33 20 02 00 03 34 02 34 31 33 23 01 23 30 23 01 24 00 40 20 40 03 24 00 03 20 23 01 44 40 30 34 02 03 20 23 01 44 01 24 40 30 34 02 03 20 23 03 24 00 12 33 33 01 02 40 30 34 02 12 01 33 23 01 33 01 44 23 01 02 31 22 03 20 01 02 20 22 02 01 02 00 11 20 00 32 34 20 22 01 02 00 04 30 24 11 10 22 03 20 33 01 33 11 03 24 02 22 01 34 33 24 34 20 00 10 01 02 31 01 34 31 22 01 02 13 03 33 02 22 30 20 24 11 34 31 33 30 13 33 02 32 34 20 22 34 20 00 11 30 24 00 22 23 01 01 02 00 10 30 34 40 01 33 00 01 11 01 40 30 20 22 01 02 31 34 20 02 20 22 02 01 24 01 02 00 03 22 22 11 03 24 02 22 01 02 40 01 24 00 02 11 03 24 02 22 01 02 12 22 30 00 02 40 01 33 02 22 01 02 24 30 20 33 02 10 14 01 40 03 22 01 00 02 01 00 22 01 02 02 03 24 13 22 03 24 00 02 04 20 22 22 30 00 02 22 01 02 43 01 34 42 12 20 42 02 02 34 33 22 01 02 00 30 20 22 01 02 20 20 10 01 34 42 40 01 33 02 32 34 20 10 01 00 03 31 00 33 01 03 22 22 03 20 00 22 30 24 00 13 30 33 13 20 20 20 30 14 00 03 24 11 20 02 32 34 01 22 04 03 02 14 22 03 02 10 14 01 44 10 01 02 04 03 33 04 03 33 01 02 02 00 03 22 01 22 10 14 03 12 03 34 11 11 01 00 01 02 23 01 23 04 33 01 02 10 14 03 33 13 32 34 01 22 01 04 30 34 33 33 01 03 34 33 03 24 13 01 03 24 00 02 01 02 13 22 03 20 40 01 02 01 00 02 01 02 04 03 33 33 01 02 12 33 30 00 00 01 03 34 13 20 04 01 00 02 30 24 30 24 13 22 01 30 00 30 24 02 03 24 13 02 01 02 00 12 20 13 10 20 01 22 00 03 24 11 20 02 32 34 01 22 01 02 10 14 20 01 24 02 11 03 24 02 10 01 02 03 24 13 40 20 01 24 24 01 24 00 04 30 20 33 01 01 00 32 34 01 22 03 23 30 34 10 14 01 14 30 33 33 20 04 22 01 01 02 02 03 20 23 03 34 40 30 22 30 43 01 34 42 10 30 23 23 01 11 03 24 02 34 24 01 33 34 10 14 01 01 24 00 33 01 01 24 00 03 04 30 34 10 14 01 24 30 20 33 01 01 00 04 30 34 33 11 30 24 24 01 03 34 02 30 22 01 20 22 11 03 24 02 22 01 02 00 33 30 34 02 11 01 00 01 02 43 01 34 42 00 03 24 11 20 02 32 34 10 14 01 40 01 22 01 01 00 02 03 24 02 40 30 20 42 02 03 24 02 31 03 34 31 20 33 01 02 00 03 00 00 01 04 22 23 01 01 02 00 22 02 34 33 34 24 20 24 12 23 01 31 20 01 34 22 20 40 33 01 03 34 42 40 20 22 02 03 12 12 33 30 24 00 02 23 01 34 33 00 33 20 01 10 30 34 31 02 11 01 31 20 01 33 33 01 02 20 10 20 11 01 33 33 20 33 01 00 30 20 23 03 33 00 43 33 30 24 40 01 24 11 00 30 24 11 20 01 34 10 01 11 20 01 34 32 34 20 24 01 02 00 32 34 00 30 20 23 03 33 00 43 33 30 24 00 01 22 01 40 30 22 01 30 24 22 01 22 20 40 33 01 23 03 24 11 33 20 24 10 01 11 20 01 34 31 30 34 33 32 34 20 00 34 23 01 34 33 02 11 01 02 14 30 23 23 01 02 10 30 23 23 01 00 30 20 33 01 40 00 34 02 11 01 22 00 30 22 01 31 30 34 33 00 33 01 10 03 33 11 20 24 03 34 42 31 30 34 33 00 33 01 02 24 03 00 01 34 33 02 11 01 02 31 33 00 33 01 02 31 30 34 33 03 40 30 20 33 11 01 02 31 03 22 03 20 02 11 01 02 10 03 33 33 30 02 02 01 02 01 00 11 01 02 03 33 11 20 24 02 22 00 33 20 03 24 00 02 30 34 02 22 01 10 20 01 22 04 22 01 34 31 30 34 33 03 33 13 01 24 00 01 33 22 01 34 33 23 20 00 33 01 01 00 31 30 34 33 11 30 33 01 33 22 01 34 33 02 10 33 30 02 02 01 02 31 30 34 33 04 30 20 33 01 11 01 04 30 24 40 20 24 03 02 02 20 02 31 33 02 11 34 24 04 30 24 12 01 34 03 34 12 30 33 04 03 24 11 30 24 00 22 03 23 03 20 24 11 03 24 02 22 01 23 01 34 33 00 33 01 01 02 00 00 33 01 23 31 01 03 34 22 03 33 33 30 24 10 14 03 33 13 11 30 33 32 34 20 31 03 43 01 01 00 32 34 20 02 30 34 33 20 00 13 33 03 24 11 11 20 01 34 33 01 00 30 34 33 24 01 00 30 20 40 01 33 02 24 30 34 02 00 00 01 10 30 34 31 01 20 22 02 40 01 24 11 01 24 00 02 34 02 10 14 33 20 02 00 20 22 02 40 01 24 11 01 24 00 02 34 02 10 14 33 20 02 00 20 22 02 22 20 40 33 01 24 00 03 34 04 03 24 11 20 00 31 30 34 33 32 34 01 22 32 34 01 02 02 03 10 02 02 30 33 11 20 11 01 02 22 40 03 24 13 20 22 01 22 03 22 30 20 22 03 34 00 01 22 31 30 34 40 03 24 00 01 00 22 03 34 02 00 20 10 01 03 34 42 43 01 34 42 02 40 33 01 02 01 00 10 03 24 11 20 11 01 02 01 00 22 00 30 20 22 01 11 34 10 30 01 34 33 14 34 23 03 20 24 22 03 40 33 20 00 22 01 02 04 30 24 02 01 00 02 40 20 40 03 24 00 02 03 34 04 03 13 24 01 30 34 23 30 33 00 02 03 34 42 12 22 01 34 40 01 02 22 14 30 23 23 01 34 02 00 01 31 33 30 02 10 33 20 00 31 03 33 10 03 33 00 30 34 10 14 01 02 43 22 22 03 22 20 24 24 30 10 01 24 00 13 30 33 13 22 01 11 01 34 20 22 02 03 10 33 11 01 02 40 01 34 40 01 02 22 01 02 31 22 01 34 33 02 11 01 22 30 33 31 14 01 22 20 24 20 22 02 40 01 24 11 01 24 00 00 30 34 00 10 01 22 03 00 30 34 00 22 03 12 30 20 22 01 02 01 33 23 01 24 00 32 34 01 11 20 01 34 00 20 01 24 00 02 30 34 02 02 03 13 03 33 11 01 22 01 02 03 20 24 00 00 01 23 31 22 01 30 23 30 34 33 03 24 00 00 34 11 20 02 20 24 00 33 30 04 30 20 22 02 22 20 40 33 01 24 00 00 30 34 00 31 34 11 01 34 33 40 01 33 00 34 23 03 33 00 43 33 33 01 13 03 33 11 01 33 30 34 40 33 01 00 01 02 43 01 34 42 32 34 01 23 31 22 20 00 22 03 22 34 01 34 33 11 34 00 30 23 04 01 03 34 20 22 02 40 01 24 11 01 24 00 22 03 33 10 14 01 03 34 13 34 02 00 01 30 22 14 30 02 00 20 01 00 20 24 10 01 22 22 01 20 22 02 40 01 24 11 01 24 00 10 14 33 20 02 00 00 01 11 20 02 01 01 00 02 01 02 23 01 23 04 33 01 02 22 20 02 20 22 02 40 01 24 11 01 24 00 22 03 02 34 01 34 33 32 34 20 02 34 33 02 30 24 12 33 30 24 00 33 34 20 02 02 01 22 22 01 01 00 22 01 02 10 22 30 34 02 11 01 02 01 02 23 03 20 24 02 01 00 22 01 02 10 22 30 34 02 11 01 02 01 02 31 20 01 11 02 20 22 02 40 01 24 11 01 24 00 03 34 04 33 20 13 03 24 11 32 34 20 10 14 01 44 22 34 20 22 01 02 03 00 00 20 33 01 22 01 13 33 03 24 11 10 33 34 10 20 12 20 02 34 33 22 01 02 14 30 23 23 01 02 31 01 24 10 14 20 22 02 40 01 24 11 01 24 00 02 03 31 03 33 30 22 01 20 22 02 40 01 24 11 01 24 00 02 30 24 23 03 33 00 43 33 01 01 00 00 30 24 23 03 33 00 43 33 01 00 30 20 31 03 33 11 01 02 02 34 02 22 01 23 03 33 10 14 00 03 24 00 31 30 34 33 22 01 02 10 30 34 31 02 11 01 12 30 34 01 00 32 34 20 22 33 01 34 00 22 03 31 30 33 00 01 10 02 03 33 00 03 24 00 31 30 34 33 22 03 23 01 24 00 03 24 00 31 30 34 33 22 03 22 22 22 34 20 03 00 03 24 00 31 30 34 33 22 03 31 20 01 33 33 01 30 40 20 24 00 14 01 34 33 00 01 33 02 03 00 00 01 23 30 33 00 01 00 03 24 00 31 30 34 33 22 01 11 33 03 31 33 30 34 13 20 32 34 01 02 03 04 03 33 04 01 01 02 02 34 43 03 20 22 02 40 01 24 11 01 24 00 02 01 02 13 01 24 30 34 42 23 01 34 33 00 33 20 02 02 03 31 03 22 23 01 40 01 33 00 01 02 03 31 22 03 20 01 03 34 12 22 03 24 10 02 30 24 30 01 20 22 00 30 34 00 04 03 20 13 24 11 20 24 12 20 24 20 02 01 02 31 22 01 34 33 02 02 30 24 03 13 30 24 20 01 01 00 02 03 04 30 34 10 14 01 01 24 00 33 30 34 40 01 33 00 01 01 00 22 01 10 33 20 32 34 20 22 31 30 34 02 02 03 22 03 23 23 03 02 03 04 03 10 00 14 03 24 20 20 22 02 40 01 24 11 01 24 00 22 01 02 31 34 22 10 33 01 20 22 02 40 01 24 11 01 24 00 22 01 02 00 24 04 33 01 02 22 01 02 02 33 03 31 14 20 24 02 10 14 03 24 00 03 24 00 03 34 02 01 34 20 22 31 33 30 12 30 24 11 11 01 02 10 20 01 34 42 01 00 22 03 23 33 01 11 01 04 30 34 00 02 30 34 02 22 03 33 04 33 01 03 34 42 04 33 03 02 12 34 24 04 33 01 02 32 34 20 02 01 24 00 03 24 00 22 02 30 24 12 20 22 02 24 01 22 01 40 03 20 00 31 03 02 22 01 02 43 01 34 42 30 34 20 10 01 02 40 32 34 01 02 30 34 20 10 01 02 23 03 33 10 14 03 24 11 02 30 34 20 10 01 02 31 33 00 33 01 02 03 22 14 20 02 00 33 20 30 24 11 34 10 33 20 23 01 03 02 02 30 34 40 20 10 30 34 33 30 24 24 03 10 01 24 33 30 24 33 01 31 34 32 34 20 33 20 00 31 03 33 23 20 22 01 02 00 33 03 00 33 01 02 34 24 31 20 01 11 02 34 33 00 14 33 03 02 03 02 34 24 10 30 34 11 01 02 34 33 31 14 33 43 24 03 34 40 30 22 01 34 33 32 34 20 00 34 03 22 01 02 22 30 20 02 10 30 34 31 02 11 01 10 33 30 02 02 01 03 34 31 20 33 03 00 01 01 23 31 01 33 01 34 33 24 03 31 30 22 30 24 11 01 33 24 20 01 33 20 40 33 01 11 01 34 42 12 30 20 02 20 23 23 30 24 11 01 01 24 10 30 33 31 22 34 02 32 34 01 12 33 30 10 01 31 30 34 33 10 01 03 34 11 03 24 02 22 01 10 22 30 03 32 34 01 01 00 22 30 34 31 11 03 24 02 22 01 10 14 03 33 24 20 01 33 20 22 02 40 01 24 11 01 24 00 23 03 33 00 43 33 22 01 11 20 01 34 31 01 24 02 20 12 01 00 31 22 01 32 34 20 11 01 04 30 34 00 02 34 33 22 03 00 01 33 33 01 01 00 02 30 34 02 22 01 12 20 33 23 03 23 01 24 00 00 33 20 02 00 01 01 00 24 30 34 02 02 30 34 33 20 03 24 00 11 03 24 02 24 30 00 33 01 24 34 20 00 12 03 00 03 22 01 02 34 33 22 01 24 30 20 33 13 30 22 13 30 00 14 03 02 03 20 13 24 01 00 01 33 24 01 22 22 01 23 01 24 00 \ No newline at end of file diff --git a/examples/sonnet116.txt b/examples/sonnet116.txt new file mode 100644 index 0000000..a783cd6 --- /dev/null +++ b/examples/sonnet116.txt @@ -0,0 +1,16 @@ +Let me not to the marriage of true minds +Admit impediments. Love is not love +Which alters when it alteration finds, +Or bends with the remover to remove: +O no! it is an ever-fixed mark +That looks on tempests and is never shaken; +It is the star to every wandering bark, +Whose worth’s unknown, although his height be taken. +Love’s not Time’s fool, though rosy lips and cheeks +Within his bending sickle’s compass come: +Love alters not with his brief hours and weeks, +But bears it out even to the edge of doom. +If this be error and upon me proved, +I never writ, nor no man ever loved. + +William Shakespeare diff --git a/src/functions.h b/src/functions.h index 877894b..3322c49 100755 --- a/src/functions.h +++ b/src/functions.h @@ -5,7 +5,7 @@ #include #include -#define BUFFER_SIZE 4092 +#define BUFFER_SIZE 4096 /* Functions */ void usage(); diff --git a/src/main.c b/src/main.c index 6d1bb49..728721f 100755 --- a/src/main.c +++ b/src/main.c @@ -113,6 +113,8 @@ int main(int argc, char *argv[]) { if(strcmp(hook, "crypt") == 0) cryptPolybius(fileSrc, fileDst, key); + else + decryptPolybius(fileSrc, fileDst, key); } /* Display error */ diff --git a/src/polybius.c b/src/polybius.c index 675c5e2..318c411 100644 --- a/src/polybius.c +++ b/src/polybius.c @@ -6,12 +6,13 @@ int cryptPolybius(const char *filenameSrc, const char *filenameDst, const char * FILE *f = NULL, *fDst = NULL; char data[BUFFER_SIZE]; char dataEncrypted[BUFFER_SIZE]; - int size = 0, end = 0; + int size = 0, end = 0, i = 0, j = 0; + char c = 0; generateSquarePolybius(polybius, key); - for (int i = 0; i < POLYBIUS_SIZE; i++){ - for (int j = 0; j < POLYBIUS_SIZE; j++) + for (i = 0; i < POLYBIUS_SIZE; i++){ + for (j = 0; j < POLYBIUS_SIZE; j++) printf("%c ", polybius[i][j]); printf("\n"); } @@ -28,6 +29,23 @@ int cryptPolybius(const char *filenameSrc, const char *filenameDst, const char * end = readFile(f, &size, data); /********* Encryption **********/ + for (i = 0; i < size; i++){ + if (data[i] >= 'a' && data[i] <= 'z') + c = data[i] - 32; + else c = data[i]; + + for (j = 0; j < POLYBIUS_SIZE; j++){ + for (int x = 0; x < POLYBIUS_SIZE; x++){ + if (c == polybius[j][x]){ + fputc(j + '0', fDst); + fputc(x + '0', fDst); + } + } + } + if (c == '\n') + fputc('\n', fDst); + } + size = 0; memset(data, 0, BUFFER_SIZE); memset(dataEncrypted, 0, BUFFER_SIZE); @@ -38,11 +56,64 @@ int cryptPolybius(const char *filenameSrc, const char *filenameDst, const char * fclose(fDst); return 0; } +int decryptPolybius(const char *filenameSrc, const char *filenameDst, const char *key){ + char polybius[POLYBIUS_SIZE][POLYBIUS_SIZE]; + FILE *f = NULL, *fDst = NULL; + char data[BUFFER_SIZE]; + char dataEncrypted[BUFFER_SIZE]; + int size = 0, end = 0, i = 0, j = 0; + char c = 0; + + generateSquarePolybius(polybius, key); + + for (i = 0; i < POLYBIUS_SIZE; i++){ + for (j = 0; j < POLYBIUS_SIZE; j++) + printf("%c ", polybius[i][j]); + printf("\n"); + } + // Open the file + f = fopen(filenameSrc, "r+"); + if (f == NULL) return -1; + + fDst = fopen(filenameDst, "w"); + if (fDst == NULL) { + fclose(f); + return -1; + } + do { + end = readFile(f, &size, data); + + /********* Decryption **********/ + for (i = 0; i < size; i += 2){ + if (data[i] >= 0 && data[i] <= POLYBIUS_SIZE) { + int c1 = data[i] - '0'; + int c2 = data[i+1] - '0'; + char c = polybius[c1][c2]; + //printf("%d%d ", c1, c2); + //printf("%d ", c1); + printf("%c", c); + //printf("%c", data[i]); + } + else + printf("%c", data[i]); + } + + size = 0; + memset(data, 0, BUFFER_SIZE); + memset(dataEncrypted, 0, BUFFER_SIZE); + }while(end != 1); + + /* Close files */ + fclose(f); + fclose(fDst); + return 0; + +} /* This function fill the polybius square */ static void fillSquare(int pos, int *posPolybius, char *p, char polybius[POLYBIUS_SIZE][POLYBIUS_SIZE]){ - for (int i = 0; i < 5; i++){ + for (int i = 0; i < POLYBIUS_SIZE; i++){ polybius[pos][i] = p[*(posPolybius)]; *posPolybius = *posPolybius + 1; } @@ -77,14 +148,14 @@ void generateSquarePolybius(char polybius[POLYBIUS_SIZE][POLYBIUS_SIZE], const c if (c == 'J'){ // We check if I is in the array, if yes, we do not add it } - if (c == 'I'){ + /*if (c == 'I'){ // We check if J is in the array, is yes, we do not add it int res = findKeyInSquare(a, 'J'); // J not in the array, we add it if (res == 0){ a[t++] = 'A'; } - } + }*/ if (c != 'J'){ int res = findKeyInSquare(a, c); diff --git a/src/polybius.h b/src/polybius.h index f0dca90..cb27d88 100644 --- a/src/polybius.h +++ b/src/polybius.h @@ -9,6 +9,7 @@ #define ALPHABET_SIZE 26 int cryptPolybius(const char *, const char *, const char *); +int decryptPolybius(const char *, const char *, const char *); void generateSquarePolybius(char polybius[5][5], const char *); #endif