Skip to content

Commit bc04f77

Browse files
committed
chore: fix fmt
1 parent 59a51a6 commit bc04f77

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

wskdf-cli/src/main.rs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,34 +367,47 @@ fn main() -> anyhow::Result<()> {
367367
eprintln!("\nEstimated time to brute-force one preimage/key pair:");
368368
eprintln!(
369369
"{:>4} │ {:>18} │ {:>18} │ {:>18} │ {:>18}",
370-
"bits", "systematic (worst)", "random (expected)", "random (99th %ile)", "random (99.9th %ile)"
370+
"bits",
371+
"systematic (worst)",
372+
"random (expected)",
373+
"random (99th %ile)",
374+
"random (99.9th %ile)"
375+
);
376+
eprintln!(
377+
"{:->4}-┼-{:->18}-┼-{:->18}-┼-{:->18}-┼-{:->18}",
378+
"", "", "", "", ""
371379
);
372-
eprintln!("{:->4}-┼-{:->18}-┼-{:->18}-┼-{:->18}-┼-{:->18}", "", "", "", "", "");
373380

374381
for bits in 1u8..=32 {
375382
// space = 2^(bits-1) because MSB is always 1
376383
let space: f64 = 2f64.powi(bits as i32 - 1); // 2^(n-1) candidates
377-
384+
378385
// Systematic search: divide space among threads, worst case is entire partition
379386
let systematic_work = (space / threads as f64).max(1.0);
380387
let systematic_secs = systematic_work * thread_avg_time;
381-
388+
382389
// Random search: expected trials = space/2, but distributed among threads
383390
let random_expected_work = (space / (2.0 * threads as f64)).max(1.0);
384391
let random_expected_secs = random_expected_work * thread_avg_time;
385392
let random_99th_secs = random_expected_secs * percentile_multiplier(0.99);
386393
let random_999th_secs = random_expected_secs * percentile_multiplier(0.999);
387-
394+
388395
let systematic_human = pretty(systematic_secs);
389396
let random_human = pretty(random_expected_secs);
390397
let random_99th_human = pretty(random_99th_secs);
391398
let random_999th_human = pretty(random_999th_secs);
392-
eprintln!("{bits:>4} │ {systematic_human:>18} │ {random_human:>18} │ {random_99th_human:>18} │ {random_999th_human:>18}");
399+
eprintln!(
400+
"{bits:>4} │ {systematic_human:>18} │ {random_human:>18} │ {random_99th_human:>18} │ {random_999th_human:>18}"
401+
);
393402
}
394403

395404
eprintln!("\nSearch strategy explanation:");
396-
eprintln!("• Systematic search: Partitions search space among threads (worst-case time shown)");
397-
eprintln!("• Random search: Each thread picks candidates randomly (follows geometric distribution)");
405+
eprintln!(
406+
"• Systematic search: Partitions search space among threads (worst-case time shown)"
407+
);
408+
eprintln!(
409+
"• Random search: Each thread picks candidates randomly (follows geometric distribution)"
410+
);
398411
eprintln!("\nRandom search variance:");
399412
eprintln!(
400413
"• 50th percentile (median): ~{:.1}× expected time",

0 commit comments

Comments
 (0)