diff --git a/src/cipher_analytical_machine/cli/actions/cryptography.clj b/src/cipher_analytical_machine/cli/actions/cryptography.clj index 8a34e6d..cda881e 100644 --- a/src/cipher_analytical_machine/cli/actions/cryptography.clj +++ b/src/cipher_analytical_machine/cli/actions/cryptography.clj @@ -1,7 +1,9 @@ (ns cipher-analytical-machine.cli.actions.cryptography (:require + [clojure.string :as cs] [cipher-analytical-machine.ciphers.caesar :as caesar] [cipher-analytical-machine.ciphers.simple-substitution :as ss] + [cipher-analytical-machine.ciphers.gamma :as gamma] [cipher-analytical-machine.parsers.parsers :as ps] [cipher-analytical-machine.parsers.simple-substitution :as pss]) (:gen-class)) @@ -38,6 +40,17 @@ substitution-table (get data "table")] (ss/decrypt-message-with-caesar message key substitution-table symbols))))) +(defn gamma-actions + [options arguments action-type] + (let [message (:message options) + key (->> (cs/split (:key options) #",") + (map #(Integer/parseInt %))) + symbols (:symbols options)] + (cond + (= action-type :encrypt) + (gamma/encrypt-message key symbols message) + ))) + (defn cryptography-actions [options arguments action-type] (let [cipher (:cipher options)] @@ -46,5 +59,8 @@ (caesar-actions options arguments action-type) (= cipher "Simple substitution and Caesar") - (simple-substitution-with-caesar-actions options arguments action-type)))) + (simple-substitution-with-caesar-actions options arguments action-type) + + (= cipher "Gamma") + (gamma-actions options arguments action-type))))