mirror of
https://github.com/TransparentLC/opencl_vanity_gpg.git
synced 2026-01-29 09:06:59 +00:00
fix: make max_time_range optional and not enabled by default
This commit is contained in:
parent
da6feeff1f
commit
b7ff1e9711
3 changed files with 28 additions and 31 deletions
37
src/main.rs
37
src/main.rs
|
|
@ -58,25 +58,22 @@ fn main() -> anyhow::Result<()> {
|
|||
.unwrap_or_else(|| chrono::Utc::now().timestamp());
|
||||
|
||||
// Use the user-specified time range instead of dimension * iteration
|
||||
let max_search_offset = ARGS.max_time_range as i64;
|
||||
|
||||
if ARGS.future_timestamp {
|
||||
info!(
|
||||
"Starting search from {} and going forward in time (up to {} seconds)",
|
||||
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
||||
.unwrap_or_else(chrono::Utc::now)
|
||||
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
||||
max_search_offset
|
||||
);
|
||||
} else {
|
||||
info!(
|
||||
"Starting search from {} and going backward in time (up to {} seconds)",
|
||||
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
||||
.unwrap_or_else(chrono::Utc::now)
|
||||
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
||||
max_search_offset
|
||||
);
|
||||
}
|
||||
info!(
|
||||
"Starting search from {} and going {} in time{}",
|
||||
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
||||
.unwrap_or_else(chrono::Utc::now)
|
||||
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
||||
if ARGS.future_timestamp {
|
||||
"forward"
|
||||
} else {
|
||||
"backward"
|
||||
},
|
||||
if ARGS.max_time_range.is_some() {
|
||||
format!(" (up to {} seconds)", ARGS.max_time_range.unwrap())
|
||||
} else {
|
||||
"".to_string()
|
||||
},
|
||||
);
|
||||
|
||||
if ARGS.output.is_none() {
|
||||
if ARGS.no_secret_key_logging {
|
||||
|
|
@ -275,7 +272,7 @@ fn opencl_thread(
|
|||
.arg(&buffer_hashdata)
|
||||
.arg(&buffer_result)
|
||||
.arg(ARGS.iteration as u64)
|
||||
.arg(ARGS.max_time_range as u32)
|
||||
.arg(ARGS.max_time_range.unwrap_or(0))
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ __kernel void vanity_sha1(__constant uint *hashdata, __global uint *result, cons
|
|||
uint offset = thread_id + i * get_global_size(0);
|
||||
|
||||
// Wrap around within max_time_range to avoid going too far
|
||||
offset = offset % max_time_range;
|
||||
if (max_time_range) offset %= max_time_range;
|
||||
|
||||
if (FUTURE_MODE) {
|
||||
// For future mode: increment timestamp within range
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ pub struct Args {
|
|||
#[arg(long, verbatim_doc_comment)]
|
||||
pub start_timestamp: Option<i64>,
|
||||
|
||||
/// Maximum time range to search in seconds (default: 86400000 = 1000 days)
|
||||
/// future_timestamp=true: search from start_timestamp to (start_timestamp + max_time_range)
|
||||
/// future_timestamp=false: search from (start_timestamp - max_time_range) to start_timestamp
|
||||
#[arg(long, default_value_t = 86400000, verbatim_doc_comment)]
|
||||
pub max_time_range: u64,
|
||||
/// Maximum time range to search in seconds
|
||||
/// future_timestamp = true: search from start_timestamp to (start_timestamp + max_time_range)
|
||||
/// future_timestamp = false: search from (start_timestamp - max_time_range) to start_timestamp
|
||||
#[arg(long, verbatim_doc_comment)]
|
||||
pub max_time_range: Option<u32>,
|
||||
}
|
||||
|
||||
impl Default for Args {
|
||||
|
|
@ -114,7 +114,7 @@ impl Default for Args {
|
|||
list_device: false,
|
||||
future_timestamp: false,
|
||||
start_timestamp: None,
|
||||
max_time_range: 86400000,
|
||||
max_time_range: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue