This commit is contained in:
rcxpony 2025-03-15 16:11:56 +05:00
parent cfecea84ec
commit 17f6d7be58

View File

@ -83,22 +83,30 @@ __device__ __forceinline__ void rmbytes(unsigned char* buf, curandState* state)
} }
__global__ void KeyGen(curandState* randStates) { __global__ void KeyGen(curandState* randStates) {
int idx = blockIdx.x * blockDim.x + threadIdx.x; int idx = blockIdx.x * blockDim.x + threadIdx.x;
unsigned local_d_high;
if (threadIdx.x == 0) {
local_d_high = d_high;
}
__syncthreads();
curandState localState = randStates[idx]; curandState localState = randStates[idx];
//printf("Seed: %s\n", ktos(seed).data);
while (true) { while (true) {
Key32 seed; Key32 seed;
KeysBox32 keys; KeysBox32 keys;
rmbytes(seed, &localState); rmbytes(seed, &localState);
ed25519_keygen(keys.PrivateKey, keys.PublicKey, seed); ed25519_keygen(keys.PrivateKey, keys.PublicKey, seed);
if (unsigned zeros = getZeros(keys.PublicKey); zeros > atomicMax((unsigned*)&d_high, zeros)) { if (unsigned zeros = getZeros(keys.PublicKey); zeros > local_d_high) {
Addr16 raw; if (zeros > atomicMax((unsigned*)&d_high, zeros)) {
Key32 inv; Addr16 raw;
invertKey(keys.PublicKey, inv); Key32 inv;
getRawAddress(zeros, inv, raw); invertKey(keys.PublicKey, inv);
printf("\nIPv6:\t%s\nPK:\t%s\nSK:\t%s\n", getAddr(raw).data, ktos(keys.PublicKey).data, ktos(keys.PrivateKey).data); getRawAddress(zeros, inv, raw);
printf("\nIPv6:\t%s\nPK:\t%s\nSK:\t%s\n", getAddr(raw).data, ktos(keys.PublicKey).data, ktos(keys.PrivateKey).data);
local_d_high = zeros;
}
} }
} }
} }
#define THREADS_P_B 256 #define THREADS_P_B 256
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
int* d_result, mBpSM, h_high; int* d_result, mBpSM, h_high;