MCPcopy Create free account
hub / github.com/brichard19/BitCrack / initializeBasePoints

Method initializeBasePoints

CLKeySearchDevice/CLKeySearchDevice.cpp:487–522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487void CLKeySearchDevice::initializeBasePoints()
488{
489 // generate a table of points G, 2G, 4G, 8G...(2^255)G
490 std::vector<secp256k1::ecpoint> table;
491
492 table.push_back(secp256k1::G());
493 for(uint64_t i = 1; i < 256; i++) {
494
495 secp256k1::ecpoint p = doublePoint(table[i - 1]);
496 if(!pointExists(p)) {
497 throw std::string("Point does not exist!");
498 }
499 table.push_back(p);
500 }
501
502 size_t count = 256;
503
504 unsigned int *tmpX = new unsigned int[count * 8];
505 unsigned int *tmpY = new unsigned int[count * 8];
506
507 for(int i = 0; i < 256; i++) {
508 unsigned int bufX[8];
509 unsigned int bufY[8];
510 table[i].x.exportWords(bufX, 8, secp256k1::uint256::BigEndian);
511 table[i].y.exportWords(bufY, 8, secp256k1::uint256::BigEndian);
512
513 for(int j = 0; j < 8; j++) {
514 tmpX[i * 8 + j] = bufX[j];
515 tmpY[i * 8 + j] = bufY[j];
516 }
517 }
518
519 _clContext->copyHostToDevice(tmpX, _xTable, count * 8 * sizeof(unsigned int));
520
521 _clContext->copyHostToDevice(tmpY, _yTable, count * 8 * sizeof(unsigned int));
522}
523
524
525

Callers

nothing calls this directly

Calls 3

GFunction · 0.85
exportWordsMethod · 0.80
copyHostToDeviceMethod · 0.80

Tested by

no test coverage detected