Update the FrequencyAnalyzer to use the frequency string instead.
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -50,10 +50,10 @@
|
|||||||
|
|
||||||
(defn frequency-analizer-get-plaintext
|
(defn frequency-analizer-get-plaintext
|
||||||
"Return the plaintext from a ciphertext using simple analizer. The function is case-insensitive."
|
"Return the plaintext from a ciphertext using simple analizer. The function is case-insensitive."
|
||||||
[ciphertext symbols letter-frequences]
|
[ciphertext symbols letter-frequencies-string]
|
||||||
(let [decrypt (reify Decrypted
|
(let [decrypt (reify Decrypted
|
||||||
(decrypt [this message key symbols]
|
(decrypt [this message key symbols]
|
||||||
(caesar/decrypt-message message key symbols)))]
|
(caesar/decrypt-message message key symbols)))]
|
||||||
(-> (new FrequencyAnalyzer ciphertext symbols letter-frequences decrypt)
|
(-> (new FrequencyAnalyzer ciphertext symbols letter-frequencies-string decrypt)
|
||||||
.crack)))
|
.crack)))
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ public class FrequencyAnalyzer {
|
|||||||
private String ciphertext;
|
private String ciphertext;
|
||||||
private int key;
|
private int key;
|
||||||
private String symbols;
|
private String symbols;
|
||||||
|
private String symbol_frequences;
|
||||||
private Decrypted decryptor;
|
private Decrypted decryptor;
|
||||||
|
|
||||||
public FrequencyAnalyzer(String ciphertext, String symbols, Map<Character, Double> symbol_frequences, Decrypted decryptor) {
|
public FrequencyAnalyzer(String ciphertext, String symbols, String symbol_frequences, Decrypted decryptor) {
|
||||||
this.ciphertext = ciphertext;
|
this.ciphertext = ciphertext;
|
||||||
this.key = 1;
|
this.key = 1;
|
||||||
this.symbols = symbols;
|
this.symbols = symbols;
|
||||||
|
this.symbol_frequences = symbol_frequences;
|
||||||
this.decryptor = decryptor;
|
this.decryptor = decryptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user