Skip to content

Commit

Permalink
String-MV-Manipulation Vorlage für die Präsentation erstellt.
Browse files Browse the repository at this point in the history
  • Loading branch information
Tristan-H11 committed Jun 3, 2024
1 parent ff87c63 commit 64dd9c0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/encryption/core/menezes_vanstone/menezes_vanstone_scheme.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::cmp::max;
use anyhow::Context;
use anyhow::{ensure, Result};

Expand All @@ -14,11 +15,15 @@ use crate::encryption::core::menezes_vanstone::keys::{
MenezesVanstoneKeyPair, MenezesVanstonePrivateKey, MenezesVanstonePublicKey,
};
use crate::encryption::encryption_types::{Decryptor, EncryptionScheme, Encryptor};
use crate::encryption::string_schemes::decimal_unicode_schemes::from_decimal_block_scheme::FromDecimalBlockScheme;
use crate::encryption::string_schemes::decimal_unicode_schemes::keys::DecimalUnicodeConversionSchemeKey;
use crate::encryption::symmetric_encryption_types::SymmetricDecryptor;
use crate::math_core::ecc::finite_field_elliptic_curve_point::FiniteFieldEllipticCurvePoint;
use crate::math_core::ecc::secure_finite_field_elliptic_curve::SecureFiniteFieldEllipticCurve;
use crate::math_core::number_theory::number_theory_service::NumberTheoryServiceTrait;
use crate::math_core::number_theory_with_prng_service::NumberTheoryWithPrngService;
use crate::math_core::traits::increment::Increment;
use crate::math_core::traits::logarithm::Logarithm;
use crate::shared::errors::MenezesVanstoneError;
use crate::shared::hashing::sha256;

Expand Down Expand Up @@ -76,13 +81,19 @@ impl From<MvSignatureBean> for MenezesVanstoneSignature {
let r: BigInt = signature.r.parse().unwrap();
let s: BigInt = signature.s.parse().unwrap();

// TODO Präsi: Einkommentieren, wenn der String manipuliert werden soll.
// let radix = 55296;

// Die größere der beiden Blockgrößen, damit sicher beide Werte enthalten sein werden.
//
// // Die größere der beiden Blockgrößen, damit sicher beide Werte enthalten sein werden.
// let block_size = max(r.log(&radix.into()) + 1, s.log(&radix.into()) + 1);
// let key = DecimalUnicodeConversionSchemeKey { block_size, radix };
//
// let blocks = FromDecimalBlockScheme::decrypt(&signature.string_representation, &key);
//
// assert!(blocks.len() > 1);
//
// let r = blocks[0].clone();
// let s = blocks[1].clone();

MenezesVanstoneSignature { r, s }
}
Expand Down

0 comments on commit 64dd9c0

Please sign in to comment.