Skip to content

Commit 2ddad70

Browse files
🎲 Rastgele sayıları doğru şekilde al (64 byte, /dev/randomdan) (#1)
1 parent 16c8a8d commit 2ddad70

File tree

3 files changed

+15
-23
lines changed

3 files changed

+15
-23
lines changed

.gitignore

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Makefile artifacts
1+
.vscode
22
*.o
33
*.so
4-
cache-opencl.*
54
bin
6-
profanity
5+
cache-opencl.*
6+
profanity

Dispatcher.cpp

+6-18
Original file line numberDiff line numberDiff line change
@@ -90,26 +90,14 @@ cl_kernel Dispatcher::Device::createKernel(cl_program & clProgram, const std::st
9090
}
9191

9292
cl_ulong4 Dispatcher::Device::createSeed() {
93-
#ifdef PROFANITY_DEBUG
94-
cl_ulong4 r;
95-
r.s[0] = 1;
96-
r.s[1] = 1;
97-
r.s[2] = 1;
98-
r.s[3] = 1;
99-
return r;
100-
#else
101-
// Randomize private keys
102-
std::random_device rd;
103-
std::mt19937_64 eng(rd());
104-
std::uniform_int_distribution<cl_ulong> distr;
105-
93+
std::random_device rd("/dev/random");
10694
cl_ulong4 r;
107-
r.s[0] = distr(eng);
108-
r.s[1] = distr(eng);
109-
r.s[2] = distr(eng);
110-
r.s[3] = distr(eng);
95+
r.s[0] = (((uint64_t) rd()) << 32) | rd();
96+
r.s[1] = (((uint64_t) rd()) << 32) | rd();
97+
r.s[2] = (((uint64_t) rd()) << 32) | rd();
98+
r.s[3] = (((uint64_t) rd()) << 32) | rd();
99+
printf("Şu rastgele sayılar kullanılıyor: %llx, %llx, %llx, %llx\n", r.s[0], r.s[1], r.s[2], r.s[3]);
111100
return r;
112-
#endif
113101
}
114102

115103
Dispatcher::Device::Device(Dispatcher & parent, cl_context & clContext, cl_program & clProgram, cl_device_id clDeviceId, const size_t worksizeLocal, const size_t size, const size_t index, const Mode & mode) :

eulogy.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,18 @@ def contract_address(sender: str, nonce=0) -> str:
1212
address_bytes = h[12:]
1313
return to_checksum_address(address_bytes)
1414

15+
Count = 0
16+
1517
def f(priv):
18+
global Count
1619
acc = Account.from_key(priv)
1720
deployer = acc.address
1821
deployed = contract_address(acc.address)
22+
Count += 1
1923
if deployed.startswith("0xcCc") and deployed.endswith("cCc"):
20-
print("Found: ", priv, deployer, deployed)
24+
print(f"C: {Count} Hit: {deployed} {priv} {deployer}")
2125
else:
22-
print("Missed:", priv, deployer, deployed)
26+
print(f"C: {Count} Miss: {deployed} {priv} {deployer}")
2327

2428

2529
started = False

0 commit comments

Comments
 (0)