From 95f1c4c21d1738fefc135226ee80017051693e38 Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Wed, 18 Oct 2023 12:54:54 -0400 Subject: [PATCH] Fixes cryptography tests utils --- teos-common/src/cryptography.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/teos-common/src/cryptography.rs b/teos-common/src/cryptography.rs index 91e53ae8..cf5fef32 100644 --- a/teos-common/src/cryptography.rs +++ b/teos-common/src/cryptography.rs @@ -81,17 +81,13 @@ pub fn decrypt(encrypted_blob: &[u8], secret: &Txid) -> Result Vec { let mut rng = rand::thread_rng(); let uniform_u8 = Uniform::new(u8::MIN, u8::MAX); - let v: Vec = (&mut rng).sample_iter(uniform_u8).take(size).collect(); - - v + (&mut rng).sample_iter(uniform_u8).take(size).collect() } /// Gets a key pair generated in a pseudorandom way. pub fn get_random_keypair() -> (SecretKey, PublicKey) { - let raw_sk = get_random_bytes(32); - loop { - if let Ok(sk) = SecretKey::from_slice(&raw_sk) { + if let Ok(sk) = SecretKey::from_slice(&get_random_bytes(32)) { return (sk, PublicKey::from_secret_key(&Secp256k1::new(), &sk)); } }