diff --git a/README.md b/README.md index 9cf1c01..5a2bdee 100755 --- a/README.md +++ b/README.md @@ -283,6 +283,7 @@ SlowKey Parameters: ████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░ 5/10 80% (10s) +Current checkpoint: 1/2 Created checkpoint #5 with data hash 0x3c0c7ab8bb2001c1efd67ce049a437c760cf95d4cc2967160b708fb7216d74d1 ``` diff --git a/src/main.rs b/src/main.rs index f4743c3..21f9036 100755 --- a/src/main.rs +++ b/src/main.rs @@ -542,14 +542,14 @@ fn main() { pb.enable_steady_tick(Duration::from_secs(1)); + let checkpoint_count = ((slowkey_opts.iterations - offset) / checkpointing_interval) as u64; + let mut current_checkpoint = 0; let mut cpb: Option = None; if checkpoint.is_some() && checkpointing_interval != 0 { cpb = Some( - mb.add(ProgressBar::new( - ((slowkey_opts.iterations - offset) / checkpointing_interval) as u64, - )) - .with_style(ProgressStyle::with_template("{msg}").unwrap()), + mb.add(ProgressBar::new(checkpoint_count)) + .with_style(ProgressStyle::with_template("{msg}").unwrap()), ); if let Some(ref mut cpb) = &mut cpb { @@ -575,6 +575,8 @@ fn main() { // Create a checkpoint if we've reached the checkpoint interval if checkpointing_interval != 0 && (current_iteration + 1) % checkpointing_interval == 0 { + current_checkpoint += 1; + let prev_data: Option<&[u8]> = if current_iteration == 0 { None } else { Some(&prev_data) }; if let Some(checkpoint) = &mut checkpoint { @@ -585,7 +587,9 @@ fn main() { let hash = Checkpoint::hash_checkpoint(current_iteration, current_data, prev_data); cpb.set_message(format!( - "\nCreated checkpoint #{} with data hash {}", + "\nCurrent checkpoint: {}/{}\nCreated checkpoint #{} with data hash {}", + current_checkpoint, + checkpoint_count, (current_iteration + 1).to_string().cyan(), format!("0x{}", hex::encode(hash)).cyan() ));