Compare commits

..
3 Commits
Author SHA1 Message Date
KKlochko 0261c97d76 Add the option for the gamma cipher.
continuous-integration/drone/push Build is passing
2023-10-31 16:50:25 +02:00
KKlochko 79b72fccca Fix the key parsing in the gamma actions. 2023-10-31 16:49:30 +02:00
KKlochko 5843695a40 Add the action of decryption for the gamma cipher. 2023-10-31 16:48:40 +02:00
2 changed files with 6 additions and 3 deletions
@@ -44,12 +44,15 @@
[options arguments action-type] [options arguments action-type]
(let [message (:message options) (let [message (:message options)
key (->> (cs/split (:key options) #",") key (->> (cs/split (:key options) #",")
(map #(Integer/parseInt %))) (map #(Integer/parseInt %))
(into []))
symbols (:symbols options)] symbols (:symbols options)]
(cond (cond
(= action-type :encrypt) (= action-type :encrypt)
(gamma/encrypt-message key symbols message) (gamma/encrypt-message key symbols message)
)))
(= action-type :decrypt)
(gamma/decrypt-message key symbols message))))
(defn cryptography-actions (defn cryptography-actions
[options arguments action-type] [options arguments action-type]
@@ -22,7 +22,7 @@
(option-values-as-list option values))) (option-values-as-list option values)))
(def cipher-options (def cipher-options
#{"Caesar" "Simple substitution and Caesar"}) #{"Caesar" "Simple substitution and Caesar" "Gamma"})
(def default-cipher "Caesar") (def default-cipher "Caesar")