merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
Showing only changes of commit 6682a66958 - Show all commits

View File

@ -5,6 +5,17 @@ use crate::{
model::models::*,
};
static SYNDROMES: LazyLock<HashMap<usize, (bool, bool, bool)>> = LazyLock::new(|| {
HashMap::from([
(1, (false, true, true)),
(2, (false, false, true)),
(3, (true, false, true)),
(4, (false, true, false)),
(5, (true, true, false)),
(6, (true, false, false)),
(7, (false, false, false)),
])
});
pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String, String> {
let length_of_code: usize = mode.clone() as usize;
@ -51,15 +62,6 @@ pub fn hamming_encrypt_data(data: &Vec<u8>, result_string: &mut String, length_o
pub fn hamming_decrypt_data(data: &Vec<u8>, result_string: &mut String, length_of_code: usize) {
let mut general_length: usize = length_of_code;
let syndromes: HashMap<usize, (bool, bool, bool)> = HashMap::from([
(1, (false, true, true)),
(2, (false, false, true)),
(3, (true, false, true)),
(4, (false, true, false)),
(5, (true, true, false)),
(6, (true, false, false)),
(7, (false, false, false)),
]);
let mut errors: String = String::new();