1
0
Fork 0
mirror of https://github.com/TransparentLC/opencl_vanity_gpg.git synced 2026-01-29 09:06:59 +00:00

fix: break instead of wrap in max_time_range mode

This commit is contained in:
✨小透明・宸✨ 2026-01-06 15:47:30 +08:00
parent cde0d2ba61
commit 55bc233c41
No known key found for this signature in database
GPG key ID: C90F42D9852EE21E
2 changed files with 7 additions and 3 deletions

View file

@ -10,6 +10,7 @@ use std::{
sync::{mpsc::*, LazyLock}, sync::{mpsc::*, LazyLock},
thread, thread,
time::Instant, time::Instant,
usize,
}; };
use utils::ARGS; use utils::ARGS;
use utils::*; use utils::*;
@ -167,7 +168,10 @@ fn main() -> anyhow::Result<()> {
thread::spawn(move || opencl_thread(buffer_result, pro_que, rx_hashdata, tx_result)); thread::spawn(move || opencl_thread(buffer_result, pro_que, rx_hashdata, tx_result));
let bench_size = (dimension * iteration) as u64; let bench_size = std::cmp::min(
(dimension * iteration) as u64,
ARGS.max_time_range.map(|x| x as u64).unwrap_or(u64::MAX),
);
let bar = bars.add(init_progress_bar(estimate)); let bar = bars.add(init_progress_bar(estimate));
loop { loop {

View file

@ -19,8 +19,8 @@ __kernel void vanity_sha1(__constant uint *hashdata, __global uint *result, cons
// Each thread gets a small sequential offset // Each thread gets a small sequential offset
uint offset = thread_id + i * get_global_size(0); uint offset = thread_id + i * get_global_size(0);
// Wrap around within max_time_range to avoid going too far // Avoid going too far (within max_time_range)
if (max_time_range) offset %= max_time_range; if (max_time_range && offset > max_time_range) break;
if (FUTURE_MODE) { if (FUTURE_MODE) {
// For future mode: increment timestamp within range // For future mode: increment timestamp within range