Skip to content

Commit f8163f4

Browse files
author
vxfemboy
committed
I AM YIFFING FOR LINT-PERFECTION...4 plz >~<
1 parent 68fb4f0 commit f8163f4

File tree

3 files changed

+31
-20
lines changed

3 files changed

+31
-20
lines changed

benches/compression_benchmarks.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,7 @@ fn bench_compression_quality(c: &mut Criterion) {
8989
.into_iter()
9090
.collect::<Vec<u8>>(),
9191
),
92-
(
93-
"repeated_patterns",
94-
[0x41u8, 0x42u8, 0x43u8].repeat(3333),
95-
),
92+
("repeated_patterns", [0x41u8, 0x42u8, 0x43u8].repeat(3333)),
9693
];
9794

9895
let compressor = SmartCompressor::new();

src/crypto/post_quantum.rs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -83,32 +83,46 @@ impl HybridKeyPair {
8383
// Load Kyber keys from serialized files with better error handling
8484
let kyber_pub_path_obj = std::path::Path::new(kyber_pub_path);
8585
let kyber_sec_path_obj = std::path::Path::new(kyber_sec_path);
86-
86+
8787
// Check if Kyber key files exist before trying to read them
8888
if !kyber_pub_path_obj.exists() {
8989
return Err(PostQuantumError::Io(io::Error::new(
9090
io::ErrorKind::NotFound,
91-
format!("Kyber public key file not found at: {:?}", kyber_pub_path_obj),
91+
format!(
92+
"Kyber public key file not found at: {:?}",
93+
kyber_pub_path_obj
94+
),
9295
)));
9396
}
94-
97+
9598
if !kyber_sec_path_obj.exists() {
9699
return Err(PostQuantumError::Io(io::Error::new(
97100
io::ErrorKind::NotFound,
98-
format!("Kyber secret key file not found at: {:?}", kyber_sec_path_obj),
101+
format!(
102+
"Kyber secret key file not found at: {:?}",
103+
kyber_sec_path_obj
104+
),
99105
)));
100106
}
101-
102-
let kyber_public_bytes =
103-
std::fs::read(kyber_pub_path).map_err(|e| PostQuantumError::Io(io::Error::new(
107+
108+
let kyber_public_bytes = std::fs::read(kyber_pub_path).map_err(|e| {
109+
PostQuantumError::Io(io::Error::new(
104110
e.kind(),
105-
format!("Failed to read Kyber public key from {:?}: {}", kyber_pub_path_obj, e),
106-
)))?;
107-
let kyber_secret_bytes =
108-
std::fs::read(kyber_sec_path).map_err(|e| PostQuantumError::Io(io::Error::new(
111+
format!(
112+
"Failed to read Kyber public key from {:?}: {}",
113+
kyber_pub_path_obj, e
114+
),
115+
))
116+
})?;
117+
let kyber_secret_bytes = std::fs::read(kyber_sec_path).map_err(|e| {
118+
PostQuantumError::Io(io::Error::new(
109119
e.kind(),
110-
format!("Failed to read Kyber secret key from {:?}: {}", kyber_sec_path_obj, e),
111-
)))?;
120+
format!(
121+
"Failed to read Kyber secret key from {:?}: {}",
122+
kyber_sec_path_obj, e
123+
),
124+
))
125+
})?;
112126

113127
// Deserialize Kyber keys
114128
let kyber_public = Kyber512PublicKey::from_bytes(&kyber_public_bytes).map_err(|e| {

src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
280280
Command::GenerateHybridKey { name } => {
281281
println!("🔐 Generating new hybrid post-quantum keypair...");
282282
let name = name.unwrap_or_else(|| "default".to_string());
283-
283+
284284
// Generate hybrid key pair
285285
let hybrid_keypair = crypto::post_quantum::HybridKeyPair::new()?;
286-
286+
287287
// Set up file paths
288288
let ecdh_pub_path = keystore
289289
.keys_dir
@@ -309,7 +309,7 @@ fn run() -> Result<(), Box<dyn std::error::Error>> {
309309
kyber_pub_path.to_str().unwrap(),
310310
kyber_sec_path.to_str().unwrap(),
311311
)?;
312-
312+
313313
println!("✨ Generated hybrid post-quantum keys:");
314314
println!(" ECDH Public key: {}", ecdh_pub_path.display());
315315
println!(" ECDH Private key: {}", ecdh_sec_path.display());

0 commit comments

Comments
 (0)