Skip to content

Commit

Permalink
added gost
Browse files Browse the repository at this point in the history
  • Loading branch information
SymmetricChaos committed Aug 16, 2024
1 parent e1aad81 commit aa45914
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 42 deletions.
3 changes: 3 additions & 0 deletions src/cipher_panel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ pub struct CipherInterface {
blowfish: blowfish_controls::BlowfishFrame,
des: des_controls::DesFrame,
desx: desx_controls::DesXFrame,
gost: gost_controls::GostFrame,
idea: idea_controls::IdeaFrame,
rc5: rc5_controls::Rc5Frame,
tea: tea_controls::TeaFrame,
Expand Down Expand Up @@ -312,6 +313,7 @@ impl CipherInterface {
CipherId::Blowfish,
CipherId::Des,
CipherId::DesX,
CipherId::Gost,
CipherId::Idea,
CipherId::Rc5,
CipherId::Tea,
Expand Down Expand Up @@ -383,6 +385,7 @@ impl CipherInterface {
CipherId::Dryad => &mut self.dryad,
CipherId::Enigma => &mut self.enigma,
CipherId::FourSquare => &mut self.four_square,
CipherId::Gost => &mut self.gost,
CipherId::Grille => &mut self.grille,
CipherId::Hebern => &mut self.hebern,
CipherId::Hutton => &mut self.hutton,
Expand Down
17 changes: 3 additions & 14 deletions src/cipher_panel/tea_controls.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use super::CipherFrame;
use crate::ui_elements::{block_cipher_mode, block_cipher_padding, UiElements};
use ciphers::{
digital::block_ciphers::{block_cipher::BCMode, tea::Tea},
Cipher,
};
use ciphers::{digital::block_ciphers::tea::Tea, Cipher};
use egui::Ui;
use rand::{thread_rng, Rng};

Expand Down Expand Up @@ -52,17 +49,9 @@ impl CipherFrame for TeaFrame {

ui.add_space(8.0);

if self.cipher.mode.iv_needed() {
if self.cipher.mode == BCMode::Ctr {
ui.subheading("Counter");
} else {
ui.subheading("Initialization Vector");
}
} else {
ui.subheading("Counter/IV Not Needed");
}

ui.add_enabled_ui(self.cipher.mode.iv_needed(), |ui| {
ui.subheading("IV/Counter");
ui.label("In the selected mode the cipher must have a 64-bit initial value provided.");
ui.u64_drag_value_hex(&mut self.cipher.iv);
});

Expand Down
17 changes: 3 additions & 14 deletions src/cipher_panel/triple_des_controls.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
use super::CipherFrame;
use crate::ui_elements::{block_cipher_mode, block_cipher_padding, u64_drag_value, UiElements};
use ciphers::{
digital::block_ciphers::{
block_cipher::BCMode,
des::{des_functions::set_des_key_parity, triple_des::TripleDes},
},
digital::block_ciphers::des::{des_functions::set_des_key_parity, triple_des::TripleDes},
Cipher,
};
use egui::Ui;
Expand Down Expand Up @@ -71,17 +68,9 @@ impl CipherFrame for TripleDesFrame {

ui.add_space(8.0);

if self.cipher.mode.iv_needed() {
if self.cipher.mode == BCMode::Ctr {
ui.subheading("Counter");
} else {
ui.subheading("Initialization Vector");
}
} else {
ui.subheading("Counter/IV Not Needed");
}

ui.add_enabled_ui(self.cipher.mode.iv_needed(), |ui| {
ui.subheading("IV/Counter");
ui.label("In the selected mode the cipher must have a 64-bit initial value provided.");
ui.u64_drag_value_hex(&mut self.cipher.iv);
});

Expand Down
17 changes: 3 additions & 14 deletions src/cipher_panel/xtea_controls.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use super::CipherFrame;
use crate::ui_elements::{block_cipher_mode, block_cipher_padding, UiElements};
use ciphers::{
digital::block_ciphers::{block_cipher::BCMode, xtea::Xtea},
Cipher,
};
use ciphers::{digital::block_ciphers::xtea::Xtea, Cipher};
use egui::Ui;
use rand::{thread_rng, Rng};

Expand Down Expand Up @@ -52,17 +49,9 @@ impl CipherFrame for XteaFrame {

ui.add_space(8.0);

if self.cipher.mode.iv_needed() {
if self.cipher.mode == BCMode::Ctr {
ui.subheading("Counter");
} else {
ui.subheading("Initialization Vector");
}
} else {
ui.subheading("Counter/IV Not Needed");
}

ui.add_enabled_ui(self.cipher.mode.iv_needed(), |ui| {
ui.subheading("IV/Counter");
ui.label("In the selected mode the cipher must have a 64-bit initial value provided.");
ui.u64_drag_value_hex(&mut self.cipher.iv);
});

Expand Down

0 comments on commit aa45914

Please sign in to comment.