Skip to content

Commit

Permalink
Fix: V1.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
mm9942 authored Jan 22, 2025
1 parent b444692 commit 00357d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Core/cipher_xchacha_poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl CipherChaCha_Poly {
///
/// # Returns
/// A new CipherChaCha instance.
pub fn create(infos: CryptographicInformation, nonce: Option<String>) -> Self {
pub fn new(infos: CryptographicInformation, nonce: Option<String>) -> Self {
let nonce: [u8; 24] = match nonce {
Some(nonce) => {
let mut array = [0u8; 24];
Expand Down
12 changes: 6 additions & 6 deletions src/Core/kyber/kyber_crypto_xchacha_poly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ where
);
let file = FileMetadata::from(path, FileTypes::other(), FileState::not_encrypted());
let infos = CryptographicInformation::from(Vec::new(), passphrase.as_bytes().to_vec(), crypt_metadata, true, Some(file));
let mut xchacha = CipherChaCha_Poly::create(infos, None);
let mut xchacha = CipherChaCha_Poly::new(infos, None);
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let _ = self.kyber_data.set_nonce(hex::encode(xchacha.nonce()));
Expand Down Expand Up @@ -83,7 +83,7 @@ where
ContentType::message(),
);
let infos = CryptographicInformation::from(message.as_bytes().to_owned(), passphrase.as_bytes().to_vec(), crypt_metadata, false, None);
let mut xchacha = CipherChaCha_Poly::create(infos, None);
let mut xchacha = CipherChaCha_Poly::new(infos, None);
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let _ = self.kyber_data.set_nonce(hex::encode(xchacha.nonce()));
Expand Down Expand Up @@ -115,7 +115,7 @@ where
ContentType::message(),
);
let infos = CryptographicInformation::from(data, passphrase.as_bytes().to_vec(), crypt_metadata, false, None);
let mut xchacha = CipherChaCha_Poly::create(infos, None);
let mut xchacha = CipherChaCha_Poly::new(infos, None);
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let _ = self.kyber_data.set_nonce(hex::encode(xchacha.nonce()));
Expand Down Expand Up @@ -185,7 +185,7 @@ where
);
let file = FileMetadata::from(path, FileTypes::other(), FileState::encrypted());
let infos = CryptographicInformation::from(Vec::new(), passphrase.as_bytes().to_vec(), crypt_metadata, true, Some(file));
let mut xchacha = CipherChaCha_Poly::create(infos, Some(self.kyber_data.nonce()?.to_string()));
let mut xchacha = CipherChaCha_Poly::new(infos, Some(self.kyber_data.nonce()?.to_string()));
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let data = xchacha.decrypt(self.kyber_data.key()?, ciphertext).unwrap();
Expand Down Expand Up @@ -215,7 +215,7 @@ where
ContentType::message(),
);
let infos = CryptographicInformation::from(message, passphrase.as_bytes().to_vec(), crypt_metadata, false, None);
let mut xchacha = CipherChaCha_Poly::create(infos, Some(self.kyber_data.nonce()?.to_string()));
let mut xchacha = CipherChaCha_Poly::new(infos, Some(self.kyber_data.nonce()?.to_string()));
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let data = xchacha.decrypt(self.kyber_data.key()?, ciphertext).unwrap();
Expand Down Expand Up @@ -246,7 +246,7 @@ where
ContentType::message(),
);
let infos = CryptographicInformation::from(data, passphrase.as_bytes().to_vec(), crypt_metadata, false, None);
let mut xchacha = CipherChaCha_Poly::create(infos, Some(self.kyber_data.nonce()?.to_string()));
let mut xchacha = CipherChaCha_Poly::new(infos, Some(self.kyber_data.nonce()?.to_string()));
log_activity!("Creating a new cipher instance of XChaCha20Poly1305.", "");

let data = xchacha.decrypt(self.kyber_data.key()?, ciphertext).unwrap();
Expand Down

0 comments on commit 00357d7

Please sign in to comment.