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());
|
.unwrap_or_else(|| chrono::Utc::now().timestamp());
|
||||||
|
|
||||||
// Use the user-specified time range instead of dimension * iteration
|
// Use the user-specified time range instead of dimension * iteration
|
||||||
let max_search_offset = ARGS.max_time_range as i64;
|
info!(
|
||||||
|
"Starting search from {} and going {} in time{}",
|
||||||
if ARGS.future_timestamp {
|
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
||||||
info!(
|
.unwrap_or_else(chrono::Utc::now)
|
||||||
"Starting search from {} and going forward in time (up to {} seconds)",
|
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
||||||
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
if ARGS.future_timestamp {
|
||||||
.unwrap_or_else(chrono::Utc::now)
|
"forward"
|
||||||
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
} else {
|
||||||
max_search_offset
|
"backward"
|
||||||
);
|
},
|
||||||
} else {
|
if ARGS.max_time_range.is_some() {
|
||||||
info!(
|
format!(" (up to {} seconds)", ARGS.max_time_range.unwrap())
|
||||||
"Starting search from {} and going backward in time (up to {} seconds)",
|
} else {
|
||||||
chrono::DateTime::from_timestamp(start_timestamp, 0)
|
"".to_string()
|
||||||
.unwrap_or_else(chrono::Utc::now)
|
},
|
||||||
.to_rfc3339_opts(chrono::SecondsFormat::Millis, true),
|
);
|
||||||
max_search_offset
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ARGS.output.is_none() {
|
if ARGS.output.is_none() {
|
||||||
if ARGS.no_secret_key_logging {
|
if ARGS.no_secret_key_logging {
|
||||||
|
|
@ -275,7 +272,7 @@ fn opencl_thread(
|
||||||
.arg(&buffer_hashdata)
|
.arg(&buffer_hashdata)
|
||||||
.arg(&buffer_result)
|
.arg(&buffer_result)
|
||||||
.arg(ARGS.iteration as u64)
|
.arg(ARGS.iteration as u64)
|
||||||
.arg(ARGS.max_time_range as u32)
|
.arg(ARGS.max_time_range.unwrap_or(0))
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,17 +11,17 @@ __kernel void vanity_sha1(__constant uint *hashdata, __global uint *result, cons
|
||||||
uint data[CHUNK * 16];
|
uint data[CHUNK * 16];
|
||||||
for (uint i = 0; i < CHUNK * 16; i++) data[i] = hashdata[i];
|
for (uint i = 0; i < CHUNK * 16; i++) data[i] = hashdata[i];
|
||||||
uint nonce = data[1];
|
uint nonce = data[1];
|
||||||
|
|
||||||
uint thread_id = get_global_id(0);
|
uint thread_id = get_global_id(0);
|
||||||
|
|
||||||
for (uint i = 0; i < iter; i++) {
|
for (uint i = 0; i < iter; i++) {
|
||||||
// Use a simple sequential approach that searches close to base time first
|
// Use a simple sequential approach that searches close to base time first
|
||||||
// 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
|
// 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) {
|
if (FUTURE_MODE) {
|
||||||
// For future mode: increment timestamp within range
|
// For future mode: increment timestamp within range
|
||||||
data[1] = nonce + offset;
|
data[1] = nonce + offset;
|
||||||
|
|
|
||||||
|
|
@ -89,11 +89,11 @@ pub struct Args {
|
||||||
#[arg(long, verbatim_doc_comment)]
|
#[arg(long, verbatim_doc_comment)]
|
||||||
pub start_timestamp: Option<i64>,
|
pub start_timestamp: Option<i64>,
|
||||||
|
|
||||||
/// Maximum time range to search in seconds (default: 86400000 = 1000 days)
|
/// Maximum time range to search in seconds
|
||||||
/// future_timestamp=true: search from start_timestamp to (start_timestamp + max_time_range)
|
/// 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
|
/// future_timestamp = false: search from (start_timestamp - max_time_range) to start_timestamp
|
||||||
#[arg(long, default_value_t = 86400000, verbatim_doc_comment)]
|
#[arg(long, verbatim_doc_comment)]
|
||||||
pub max_time_range: u64,
|
pub max_time_range: Option<u32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Args {
|
impl Default for Args {
|
||||||
|
|
@ -114,7 +114,7 @@ impl Default for Args {
|
||||||
list_device: false,
|
list_device: false,
|
||||||
future_timestamp: false,
|
future_timestamp: false,
|
||||||
start_timestamp: None,
|
start_timestamp: None,
|
||||||
max_time_range: 86400000,
|
max_time_range: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue