Tristan-H11 / Kryptographie

https://krypto-gui.tristan-hoermann.de
2 stars 2 forks source link

Blockgröße aus den Keys entfernen #111

Closed Tristan-H11 closed 7 months ago

Tristan-H11 commented 7 months ago

Irgendwie gehören die Blockgrößen fachlich nicht zu den Schlüsseln. Das passt so nicht. Eigentlich bräuche es einen BlockChiffre Service, der das regeln kann.

Die Blockgröße müsste vllt immer bei Bedarf für die entsprechende Anfrage mitgegeben werden und folglich müsste man für die Schlüsselerstellung auch kein Zahlensystem mehr angeben. Das gehört da nämlich auch nicht rein.

Tristan-H11 commented 7 months ago

Blockgrößen direkt in encrypt und decrpyt berechnen. Nicht in den KEys.


pub fn encrypt(public_key: &PublicKey, plaintext: &str, g_base: u32) -> Vec<BigInt> {
    let block_size = public_key.n.log(&g_base.into());
    // Divide the plaintext into blocks and encrypt each block...
}

pub fn decrypt(private_key: &PrivateKey, ciphertext: &[BigInt], g_base: u32) -> String {
    let block_size = private_key.n.log(&g_base.into()) + 1;
    // Divide the ciphertext into blocks and decrypt each block...
}```