from collections import defaultdict
SOLVED_KEYS = {
1: 1, 2: 3, 3: 7, 4: 8, 5: 21, 10: 514
}
def calculate_pattern_score(keys):
score = 0
patterns = {
'mersenne': lambda k: all(x == (2**i - 1) for i, x in enumerate(k, start=1)),
'bitwise': lambda k: all(k[i] == (k[i-1] << 1) + 1 for i in range(1, len(k))),
'prime': lambda k: sum(is_prime(x) for x in k)
}
for name, check in patterns.items():
if name == 'mersenne' and check(keys):
score += 5
elif name == 'bitwise' and check(keys):
score += 3
elif name == 'prime':
score += min(check(keys), 2)
return score
def find_cycles(max_cycle=10):
cycle_scores = defaultdict(int)
puzzles = sorted(SOLVED_KEYS.items())
for cycle in range(2, max_cycle+1):
groups = defaultdict(list)
for idx, (pn, key) in enumerate(puzzles):
groups[idx//cycle].append((pn, key))
total_score = sum(
calculate_pattern_score([k for _, k in group])
for group in groups.values()
)
cycle_scores[cycle] = total_score
best_cycle = max(cycle_scores, key=cycle_scores.get)
return best_cycle, cycle_scores
def analyze_groups(cycle_length):
groups = defaultdict(list)
puzzles = sorted(SOLVED_KEYS.items())
for idx, (pn, key) in enumerate(puzzles):
group_id = idx // cycle_length
groups[group_id].append((pn, key))
print(f"\nCycle length: {cycle_length}")
for group_id, group in groups.items():
pns = [pn for pn, _ in group]
keys = [key for _, key in group]
print(f"Group {group_id+1} (Puzzles {pns}): Keys {keys}")
# Compare groups for cycle lengths 2 and 3
analyze_groups(2)
analyze_groups(3)
def is_prime(n):
if n < 2: return False
for i in range(2, int(n**0.5)+1):
if n % i == 0: return False
return True
# Run analysis
best_cycle, scores = find_cycles()
print(f"Most likely cycle length: {best_cycle}")
print("Cycle scores:", dict(scores))
%runfile /home/blackangel/untitled21.py --wdir
Cycle length: 2
Group 1 (Puzzles [1, 2]): Keys [1, 3]
Group 2 (Puzzles [3, 4]): Keys [7, 8]
Group 3 (Puzzles [5, 10]): Keys [21, 514]
Cycle length: 3
Group 1 (Puzzles [1, 2, 3]): Keys [1, 3, 7]
Group 2 (Puzzles [4, 5, 10]): Keys [8, 21, 514]
Most likely cycle length: 2
Cycle scores: {2: 10, 3: 10, 4: 2, 5: 5, 6: 2, 7: 2, 8: 2, 9: 2, 10: 2}
import random
from datetime import datetime, timedelta
# List of target Puzzle, each corresponding to a range
target_numbers = [
(1, 1), (2, 3), (3, 7), (4, 8), (5, 21), (6, 49), (7, 76), (8, 224), (9, 467), (10, 514),
(11, 1155), (12, 2683), (13, 5216), (14, 10544), (15, 26867), (16, 51510),
(17, 95823), (18, 198669), (19, 357535), (20, 863317), (21, 1811764),
(22, 3007503), (23, 5598802), (24, 14428676), (25, 33185509),
(26, 54538862), (27, 111949941), (28, 227634408), (29, 400708894),
(30, 1033162084), (31, 2102388551), (32, 3093472814), (33, 7137437912),
(34, 14133072157), (35, 20112871792), (36, 42387769980), (37, 100251560595),
(38, 146971536592), (39, 323724968937), (40, 1003651412950),
(41, 1458252205147), (42, 2895374552463), (43, 7409811047825),
(44, 15404761757071), (45, 19996463086597), (46, 51408670348612),
(47, 119666659114170), (48, 191206974700443), (49, 409118905032525),
(50, 611140496167764), (51, 2058769515153876), (52, 4216495639600700),
(53, 6763683971478124), (54, 9974455244496707), (55, 30045390491869460),
(56, 44218742292676575), (57, 138245758910846492), (58, 199976667976342049),
(59, 525070384258266191), (60, 1135041350219496382), (61, 1425787542618654982),
(62, 3908372542507822062), (63, 8993229949524469768),
(64, 17799667357578236628), (65, 30568377312064202855)
]
# Sort the target_numbers list by the first element of each tuple (the range start)
target_numbers.sort(key=lambda x: x[0])
# Specify the start and end date and times for the search
start_datetime_pre = datetime(2015, 1, 1, 0, 0, 0)
end_datetime_pre = datetime(2015, 1, 15, 19, 7, 14)
current_datetime = start_datetime_pre
time_step = timedelta(seconds=1)
# Initialize a set to keep track of found target numbers
found_targets = set()
# Function to find the seed for a single target number
def find_seed_for_target(target_num, current_time):
num, target_number = target_num
min_number = 2 ** (num - 1)
max_number = (2 ** num) - 1
low_seed = int(current_time.timestamp())
high_seed = int(end_datetime_pre.timestamp())
found_seed = None
while low_seed <= high_seed:
mid_seed = (low_seed + high_seed) // 2
random.seed(mid_seed)
generated_number = random.randint(min_number, max_number)
if generated_number == target_number:
found_seed = mid_seed
break
elif generated_number < target_number:
low_seed = mid_seed + 1
else:
high_seed = mid_seed - 1
return found_seed
# Iterate through the time range
while current_datetime <= end_datetime_pre:
# Find seeds for all target numbers
found_seeds = [find_seed_for_target(target, current_datetime) for target in target_numbers]
# Print the results for each target number if found and not already printed
for i, (num, target_number) in enumerate(target_numbers, start=1):
if found_seeds[i - 1] is not None and target_number not in found_targets:
linuxtime = found_seeds[i - 1]
timestamp = datetime.fromtimestamp(linuxtime)
formatted_time = timestamp.strftime('%Y-%m-%d %H:%M:%S')
print(f"Puzzle {i} : Private Key : {target_number} | Timestamp: {formatted_time}")
found_targets.add(target_number)
# Move to the next second
current_datetime += time_step
E:\Python\The_game>python The_game.py -h
usage: The_game.py [-h] [--W W] [--T T] [--K K] [--trials TRIALS] [--max_iters MAX_ITERS] [--threads THREADS] [--speed SPEED] [--mem_latency MEM_LATENCY]
Simulate Pollard ρ with multiple kangaroos and throughput estimate.
optional arguments:
-h, --help show this help message and exit
--W W Range size W
--T T Number of traps T
--K K Jump table size K
--trials TRIALS Number of trials
--max_iters MAX_ITERS
Max steps per trial
--threads THREADS Number of kangaroos per trial
--speed SPEED Predicted total CPU point‑addition throughput (p‑adds/s)
--mem_latency MEM_LATENCY
DDR RAM latency per random access (s)
#!/usr/bin/env python3
import argparse
import random
import math
from tqdm import tqdm
from typing import List, Optional
def simulate_kangaroos(W: int, T: int, K: int, trials: int, max_iters: int,
threads: int, speed: Optional[float], mem_latency: float):
L = W // T
base_jump = math.isqrt(L)
batch_size = 1024
cf_mem_bytes = 256 * 1024**3
bytes_per_entry = cf_mem_bytes / T
bits_per_entry = bytes_per_entry * 8
fp_rate = 2 ** (-bits_per_entry)
print(f"W = {W:,}, T = {T:,}, L = {L:,}, sqrt(L) = {base_jump:,}")
print(f"p = T/W = {T/W:.3e}, expected steps = {W/T:,.0f}")
print(f"Threads: {threads} (split into 3 jump tables)")
print(f"Cuckoo filter @256 GiB → {bytes_per_entry:.3f} B/entry (~{bits_per_entry:.2f} bits), FP ≈ {fp_rate:.2%}\n")
if speed is not None:
print(f"Theoretical total CPU p‑adds/s: {speed:,.0f}")
print(f"Implied per‑thread p‑adds/s : {speed/threads:,.0f}")
print(f"DDR RAM latency : {mem_latency*1e9:.1f} ns")
print(f"Batch memory access : {batch_size} keys per access\n")
else:
print()
successes = 0
hits_per_trial: List[Optional[int]] = []
for t in range(1, trials + 1):
jump_tables = [
[random.randint(1, base_jump) for _ in range(K)]
for _ in range(3)
]
X = [random.randrange(W) for _ in range(threads)]
hit_step: Optional[int] = None
hit_trap: Optional[int] = None
hit_thread: Optional[int] = None
with tqdm(total=max_iters, desc=f"Trial {t}", unit="step") as bar:
for step in range(1, max_iters + 1):
for i in range(threads):
if hit_step is not None:
break
tbl = jump_tables[i % 3]
idx = X[i] % K
X[i] = (X[i] + tbl[idx]) % W
if X[i] % L == 0:
hit_step = step
hit_thread = i + 1
hit_trap = X[i] // L
bar.update(1)
if hit_step is not None:
break
if hit_step is not None:
print(f" Kangaroo {hit_thread}: HIT at step {hit_step:,} (trap idx = {hit_trap:,})\n")
successes += 1
else:
print(f" MISS after {max_iters:,} steps\n")
hits_per_trial.append(hit_step)
print(f"Total hits: {successes} / {trials}")
hit_steps = [h for h in hits_per_trial if h is not None]
if hit_steps:
mn = min(hit_steps)
mx = max(hit_steps)
avg = sum(hit_steps) / len(hit_steps)
print(f"Steps to first hit: min={mn:,}, max={mx:,}, avg={avg:,.1f}")
if speed is not None and hit_steps:
comp_cap = speed
mem_cap = threads * batch_size / mem_latency
pred_adds = min(comp_cap, mem_cap)
wins_per_sec = pred_adds / avg
wins_floor = math.floor(wins_per_sec * 10) / 10
pts_per_sec = wins_per_sec * W
if pts_per_sec >= 1e21:
human = f"{pts_per_sec/1e21:.3f} Zpps"
elif pts_per_sec >= 1e18:
human = f"{pts_per_sec/1e18:.3f} Epps"
else:
human = f"{pts_per_sec:.3e} pts/s"
full_pts = f"{pts_per_sec:,.0f} pts/s"
overhead = 0.20
eff_adds = pred_adds * (1 - overhead)
eff_wins = eff_adds / avg
eff_wins_floor = math.floor(eff_wins * 10) / 10
eff_pts = eff_wins * W
if eff_pts >= 1e21:
human_eff = f"{eff_pts/1e21:.3f} Zpps"
elif eff_pts >= 1e18:
human_eff = f"{eff_pts/1e18:.3f} Epps"
else:
human_eff = f"{eff_pts:.3e} pts/s"
full_eff_pts = f"{eff_pts:,.0f} pts/s"
nohit_pts_per_sec = (speed / max_iters) * W
eff_nohit = nohit_pts_per_sec * (1 - overhead)
if eff_nohit >= 1e21:
human_nohit = f"{eff_nohit/1e21:.3f} Zpps"
elif eff_nohit >= 1e18:
human_nohit = f"{eff_nohit/1e18:.3f} Epps"
else:
human_nohit = f"{eff_nohit:.3e} pts/s"
full_nohit = f"{eff_nohit:,.0f} pts/s"
print("\n--- Theoretical throughput estimate ---")
print(f"Compute‑bound : {comp_cap:,.0f} p‑adds/s")
print(f"Memory‑bound : {mem_cap:,.0f} p‑adds/s")
print(f"Predicted p‑adds : {pred_adds:,.0f} p‑adds/s")
print(f"Predicted windows: {wins_floor:.1f} win/s")
print(f"Predicted points : {full_pts} ({human})")
print(f"After ~20% overhead (thread sync, atomic ops, etc):")
print(f" Effective windows: {eff_wins_floor:.1f} win/s")
print(f" Effective points : {full_eff_pts} ({human_eff})")
print(f" Effective no‑hit scanning: {full_nohit} ({human_nohit})")
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Simulate Pollard ρ with multiple kangaroos and throughput estimate.")
parser.add_argument("--W", type=int, default=10**8, help="Range size W")
parser.add_argument("--T", type=int, default=10**4, help="Number of traps T")
parser.add_argument("--K", type=int, default=64, help="Jump table size K")
parser.add_argument("--trials", type=int, default=5, help="Number of trials")
parser.add_argument("--max_iters", type=int, default=None, help="Max steps per trial")
parser.add_argument("--threads", type=int, default=2, help="Number of kangaroos per trial")
parser.add_argument("--speed", type=float, default=None, help="Predicted total CPU point‑addition throughput (p‑adds/s)")
parser.add_argument("--mem_latency", type=float, default=100e-9, help="DDR RAM latency per random access (s)")
args = parser.parse_args()
W = args.W
T = args.T
default_iters = int((W / T) * 2)
max_iters = args.max_iters if args.max_iters is not None else default_iters
simulate_kangaroos(W, T, args.K, args.trials, max_iters, args.threads, args.speed, args.mem_latency)
E:\Python\The_game>python The_game.py --W 1000000000000000000 --T 500000000000 --K 1414 --trials 10 --max_iters 200000 --threads 32 --speed 150000000
W = 1,000,000,000,000,000,000, T = 500,000,000,000, L = 2,000,000, sqrt(L) = 1,414
p = T/W = 5.000e-07, expected steps = 2,000,000
Threads: 32 (split into 3 jump tables)
Cuckoo filter @256 GiB → 0.550 B/entry (~4.40 bits), FP ≈ 4.74%
Theoretical total CPU p‑adds/s: 150,000,000
Implied per‑thread p‑adds/s : 4,687,500
DDR RAM latency : 100.0 ns
Batch memory access : 1024 keys per access
Trial 1: 5%|████████▊ | 10296/200000 [00:00<00:01, 161824.75step/s]
Kangaroo 9: HIT at step 10,296 (trap idx = 335,485,616,764)
Trial 2: 4%|███████▍ | 8597/200000 [00:00<00:01, 149881.87step/s]
Kangaroo 2: HIT at step 8,597 (trap idx = 291,414,423,644)
Trial 3: 7%|███████████▏ | 13113/200000 [00:00<00:01, 156095.86step/s]
Kangaroo 1: HIT at step 13,113 (trap idx = 371,862,088,299)
Trial 4: 49%|████████████████████████████████████████████████████████████████████████████████████▍ | 98742/200000 [00:00<00:00, 155103.27step/s]
Kangaroo 21: HIT at step 98,742 (trap idx = 209,929,031,829)
Trial 5: 7%|███████████▉ | 13926/200000 [00:00<00:01, 158877.92step/s]
Kangaroo 2: HIT at step 13,926 (trap idx = 69,456,967,361)
Trial 6: 3%|█████▊ | 6828/200000 [00:00<00:01, 152403.27step/s]
Kangaroo 4: HIT at step 6,828 (trap idx = 5,824,479,995)
Trial 7: 67%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 134098/200000 [00:00<00:00, 155850.07step/s]
Kangaroo 31: HIT at step 134,098 (trap idx = 140,162,118,610)
Trial 8: 18%|██████████████████████████████▋ | 35918/200000 [00:00<00:01, 158432.59step/s]
Kangaroo 23: HIT at step 35,918 (trap idx = 340,417,309,332)
Trial 9: 12%|████████████████████▌ | 24030/200000 [00:00<00:01, 159903.80step/s]
Kangaroo 24: HIT at step 24,030 (trap idx = 332,023,294,905)
Trial 10: 77%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▌ | 153355/200000 [00:00<00:00, 159300.14step/s]
Kangaroo 29: HIT at step 153,355 (trap idx = 269,327,468,331)
Total hits: 10 / 10
Steps to first hit: min=6,828, max=153,355, avg=49,890.3
--- Theoretical throughput estimate ---
Compute‑bound : 150,000,000 p‑adds/s
Memory‑bound : 327,680,000,000 p‑adds/s
Predicted p‑adds : 150,000,000 p‑adds/s
Predicted windows: 3006.5 win/s
Predicted points : 3,006,596,472,661,018,148,864 pts/s (3.007 Zpps)
After ~20% overhead (thread sync, atomic ops, etc):
Effective windows: 2405.2 win/s
Effective points : 2,405,277,178,128,814,309,376 pts/s (2.405 Zpps)
Effective no‑hit scanning: 600,000,000,000,000,000,000 pts/s (600.000 Epps)